刚学数据库,求sql两个表数据之间求差怎么写

日期:2017-07-25 13:00:01 人气:2

刚学数据库,求sql两个表数据之间求差怎么写

select a.[名称],a.[数量]-ISNULL(b.[数量],0) from table1 a left outer join table2 b ON a.[名称]= b.[名称] UNION Select b.[名称],-b.[数量] from table2 b where not exists(Select a.[名称] from table 1 a where a.[名称]=b.[名称])
    A+
热门评论