select 1 as 序号,bh as 编号,mc as 名称,jx as 适用机型,cd as 产地,
数量=sum(sl),金额=sum(sl*dj1)
from 
(
 select 1 as 序号,bh,mc,jx,sl,dj1,cd from 库存表 where bh = '001904001'
 union all ---union 压缩重复数据
 select 1 as 序号,bh,mc,jx,-sl,dj1,cd from 领料表 where bh = '001904001'
) a group by bh,mc,jx,cd
having sum(sl)>0  order by 编号