sql语句怎么写?
主表A
id je
1 100
2 100
字表B
id jeb
1 20
1 10
2 10
查询出
id jecc je
1 70 100
2 90 100
jecc主表的总je-字表的sum(je)
[解决办法]
select A.ID, (A.JE-B1.JEB) AS JECC,A.JE FROM A,
(select id,sum(jeb) as jeb from B group by id) B1
WHERE A.ID=B1.ID