select a.*,
(select isagree,checkdate from b where b.levs=1 and a.otID=b.otID),
(select isagree,checkdate from b where b.levs=2 and a.otID=b.otID),
(select isagree,checkdate from b where b.levs=3 and a.otID=b.otID),from a----------------------------------
这样取出来isagree,checkdate 是无列名的 怎么给他起别名?isagree as deptIsagree,checkdate as deptIscheckdate 这样不行啊
--
莫非只能对isagree,checkdate 一个一个查询 然后 在再起别名
是这样
SELECT A.*,B.isagree,B.checkdate FROM A JOIN B ON A.otID=B.otID WHERE B.levs IN(1,2,3)
--怎么返回两列 ,只能为一列取别名
http://www.jiemengwu.com/ 解梦屋 http://www.phpzy.com/php/ 绿色php资源