sql 如何将两个查询结果合并???求大神解!!!

如题所述

第1个回答  2014-02-27
select a.gno,a.gname,a.gprice,b.数量 from goods a inner join
(
       select gno,count(1) as '数量' from orders where cus_id ='666666' and status=0
       group by gno
)b on a.gno = b.gno

第2个回答  2014-02-27
select a.gno,b.gname,b.gprice,count(*) 数量
from orders a,goods b where a.gno=b.gno and a.cus_id='666666' and a.status=0
group by a.gno,b.gname,b.gprice

这样试试

本回答被提问者采纳
第3个回答  2014-02-27
select g.Gno,g.Gname,g.Gprice,count(0) as 数量 from Goods G LEFT JOIN orders o ON g.Gno=o.Gno WHERE o.Cus_ID='666666' AND o.status=0 group by o.Gno
相似回答