group by order by
select lianxi_dw.dw as dw1,count(lianxi.id) as num from lianxi_dw left join lianxi on lianxi_dw.dw=lianxi.dw group by lianxi_dw.dw order by lianxi_dw.uid
不行!
去掉order by可以查询出数据只是顺序乱了
请帮忙写下可以排序的
[解决办法]
select lianxi_dw.uid,lianxi_dw.dw as dw1,
count(lianxi.id) as num
from lianxi_dw left join lianxi
on lianxi_dw.dw=lianxi.dw
group by lianxi_dw.dw ,lianxi_dw.uid
order by lianxi_dw.uid
[解决办法]
select lianxi_dw.dw as dw1,count(lianxi.id) as num from lianxi_dw left join lianxi on lianxi_dw.dw=lianxi.dw group by lianxi_dw.dw order by min(lianxi_dw.uid)