需求:表1中有多行id相同
select a.item_code, totalAmount , b.online_qty
from (select item_code, sum(a.online_qty) as TotalAmountfrom serial_bal awhere a.wh_code = 'SJ38'group by item_code) a left join(select item_code,online_qtyfrom wh_bal bwhere b.whcode = 'SJ38') bon a.item_code = b.item_codewhere TotalAmount != b.online_qty