select *,(select sum(0),sum(1) from table1 where pid=tabel2.pid) from tabel2
报错:Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
怎么可以 查出2个sum的结果放在表后面呢
select *,(select sum(0),sum(1) from table1 where pid=tabel2.pid) from tabel2
报错:Only one expression can be specified in the select list when the subquery is not introduced with EXISTS.
怎么可以 查出2个sum的结果放在表后面呢
你用关联查询,select * from table2 a, (select sum(0),sum(1) from table1 ) b where a.id = b.id