请问一下这个SQL语句如何用tp的连贯操作写出来呢?

浏览:372 发布日期:2017/12/27 分类:求助交流
SELECT a.id,a.type,a.num,a.people_num,a.theme,a.teacher,a.date,
a.end_date,(SELECT NAME FROM `user` WHERE user.id=a.student1) AS student1_name,
(SELECT NAME FROM `user` WHERE user.id=a.student2) AS student2_name,
(SELECT NAME FROM `user` WHERE user.id=a.student3) AS student3_name 
FROM course_submission AS a  ORDER BY a.DATE ASC LIMIT 0,10
$list = $message->alias('a')->order(' date asc ')->join('LEFT JOIN `user` as b ON a.uid = b.company_id')->field('a.id,a.type,a.num,a.people_num,a.theme,a.teacher,a.date,a.end_date,a.student1,a.student2,a.student3,a.student1,a.student1,b.name,b.tel,b.img')->limit($Page->firstRow.','.$Page->listRows)->select();
echo $message->getLastSql();
这样好像不行啊
最佳答案
评论( 相关
后面还有条评论,点击查看>>