array(1) { [0] => array(5) { ["id"] => string(1) "1" ["name"] => string(7) "zzguo28" ["email"] => string(17) "zzguo28@163.com" ["mobile"] => string(11) "12345678901" ["dept"] => string(9) "销售部" } }
并可以看到使用的sql如下
"SELECT u.id AS id,u.name AS name,ui.email AS email,ui.mobile AS mobile,Dept.name AS dept FROM think_user u LEFT JOIN think_user_info ui ON ui.user_id=u.id JOIN think_dept Dept ON u.dept_id=Dept.id WHERE ( u.id = 1 ) LIMIT 1 "
视图模型在查询上和普通单表并没有多大分别,可以使用我们所熟悉的各种连贯操作,例如order,limit等等。
您可能感兴趣的文章: