Skip to content
Advertisement

How do I get two different counts from a table in select query

I am trying to have my select query pull the count of items that exist in both tables in one column, and the count of the items that only exist in one table. These two queries give me the data I need, but would like it come from one query. Thanks in advance.

Desired Result:

enter image description here

Advertisement

Answer

You can combine a SUM and an IIF statements to achive your goal :

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement