我有以下三个陈述:
select count (distinct vid) as SUM_OF_SEC from pdalis where pid in(500,504); select sum (amount*paidperitem) SUM_OF_A from pdalis where pid = 501 ; select sum(amount * paidperitem) SUM_OF_P from pdalis where pid IN (500,504);
如何将它们全部合并成3个并排的列?
尝试通过子查询
select count (distinct vid) as SUM_OF_SEC ,(select sum (amount*paidperitem) from pdalis where pid = 501 ;) AS SUM_OF_A , (select sum(amount * paidperitem) from pdalis where pid IN (500,504);) as SUM_OF_P from pdalis where pid in(500,504);