I have the two queries below I’d like to combine into one and get a difference result.
Query 1
SELECT SUM(col1 + col2) As total FROM tableA
Query 2
SELECT SUM(total) FROM tableB WHERE color not like '%black' and model not like 'CF%'
I’d like to combine these in a SELECT query and get the result: Query 1 – Query 2 = result. The tables both have a “id” as a common key between them. I’m using MS SQL Server 2008
1 Answer