G
Guest
For some reports I have various Queries setup to collect various data. I
wanted to collect a count from each Query so I ended up creating additional
Queries for each original Query. Below is the SQL for those. This seemed to
work great but was creating many extra Queries. I wanted to combine these
into a single Query.
Taking the example below there are four original Queries and then four
additional Queries totaling eight Queries. What I want to be able to achieve
is have the four original Queries and then one additional Query for a total
of five Queries. I know the difference between Five and Eight isn't that big
but this is just an example, I actually have about a dozen different Queries
so the difference is really between Twenty-Four and Thirteen (and growing).
Is it possible to combine these Queries into one Query?
Thanks in advance for any assistance.
SQL Query One ...
SELECT Count(*) AS 0to7
FROM (SELECT DISTINCT [field]
FROM [query1]
)
SQL Query Two ...
SELECT Count(*) AS 8to14
FROM (SELECT DISTINCT [field]
FROM [query2]
)
SQL Query Three ...
SELECT Count(*) AS 15to30
FROM (SELECT DISTINCT [field]
FROM [query3]
)
SQL Query Four ...
SELECT Count(*) AS 31to42
FROM (SELECT DISTINCT [field]
FROM [query4]
)
wanted to collect a count from each Query so I ended up creating additional
Queries for each original Query. Below is the SQL for those. This seemed to
work great but was creating many extra Queries. I wanted to combine these
into a single Query.
Taking the example below there are four original Queries and then four
additional Queries totaling eight Queries. What I want to be able to achieve
is have the four original Queries and then one additional Query for a total
of five Queries. I know the difference between Five and Eight isn't that big
but this is just an example, I actually have about a dozen different Queries
so the difference is really between Twenty-Four and Thirteen (and growing).
Is it possible to combine these Queries into one Query?
Thanks in advance for any assistance.
SQL Query One ...
SELECT Count(*) AS 0to7
FROM (SELECT DISTINCT [field]
FROM [query1]
)
SQL Query Two ...
SELECT Count(*) AS 8to14
FROM (SELECT DISTINCT [field]
FROM [query2]
)
SQL Query Three ...
SELECT Count(*) AS 15to30
FROM (SELECT DISTINCT [field]
FROM [query3]
)
SQL Query Four ...
SELECT Count(*) AS 31to42
FROM (SELECT DISTINCT [field]
FROM [query4]
)