How to count 2 datasets and then subtract the difference?

J

Jon

1) I need to be able to count the number of records returned by 2
queries (which I can do).
2) Then I need to subtract one count from the other and return that
number. Simple, right? When I try to do this, I get the error 'Query
input must contain at least one table or query'.

Here's the query:

SELECT
( SELECT * FROM [Level 01 Count Distinct Customers During Billing
Period])
-
(SELECT * FROM [Level 01 Count Distinct Customers During Billing
Period Only])


If I execute either of the inner selects, integers are returned as
expected. The funny thing is - if I were to execute 'SELECT (0) -
(1)' , in other words, hard coding integers, the query would return -1
as expected. So why doesn't it work by nesting queries that should
return integers?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top