thinkphp如何做表的内连接?

浏览:2436 发布日期:2014/01/15 分类:求助交流 关键字: 关联模型,内连接,分页
我有一个项目要做组织架构管理,一般组织架构是 id,pid,name,charge.
我现在想显示出来 系统ID,部门名,上级部门名字,主管名
假如有2个表 org, user表,
我需要得到如下的结果: select a.id,a.name,b.name as pname,c.username
from org a ,org b,user c where a.pid=b.id and a.charge=c.userid.
请问用thinkphp的怎么得到一个array list?
能提供关联模型分页,或者原生sql,或者join()方式都可以。
最佳答案
评论( 相关
后面还有条评论,点击查看>>