subtract two queries

L

Leslie

I have 2 queries that i want to make into one by
subtracting one from the other.
Example:
Query1: select Count(*) AS FROM appl
WHERE appl.APPLICATION_ID In (select application_id from
quote_delivery)
Query2: select count(*) from quote_delivery

I want a count for Query2 - Query1 and I would like this
to all be one query.

Is it possible?

Thanks in advance.
 
M

Michel Walsh

Hi,



SELECT SUM(z)
FROM ( SELECT COUNT(*) As z FROM table1
UNION ALL
SELECT -COUNT(*) FROM table2) As w




Hoping it may help,
Vanderghast, Access MVP
 

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