比如说:select a.id,a.name,(select sum(b.count),a.num-sum(b.count) from b) from a;
有这么一个语句,我想一下在b表里查出两个值来,作为两列字段跟a.id a.name两列的值同时都显示出来,但是我上面的写法会报错。不知道括号里的情况该怎么处理?
ps:当然我只是举了个例子,具体的语句要比这个复杂的多,求指点
比如说:select a.id,a.name,(select sum(b.count),a.num-sum(b.count) from b) from a;
有这么一个语句,我想一下在b表里查出两个值来,作为两列字段跟a.id a.name两列的值同时都显示出来,但是我上面的写法会报错。不知道括号里的情况该怎么处理?
ps:当然我只是举了个例子,具体的语句要比这个复杂的多,求指点
select a.id,a.name,c.count,a.num-c.count from a,(select sum(b.count) count from b) c