I would like to do a sql query that would take two views and compare differences in data and display only the ones which is non zero. So far I have the below but it comes up with an error saying “subquery returned more than 1 value.” Using SQL Server 2008
select * from stl_wk_vw where
ABS((select sum(missing+non_missing) as total from tdn_summary as b join stl_wk_vw as a on a.id = b.id group by b.id)
-
(select sum(st_total) from stl_wk_vw as a join tdn_summary as b on a.id = b.id where standard not like '%non' group by b.id)) > 0
1 Answer