Displaying the counts of two separate queries

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I know I can query for a count like this:
SELECT Count(*) As ReviewCount FROM [Select for Review labels];

Which gives me the number of records in [Select for Review labels], but what
I would like is a query that returns 3 fields: The above, the same thing
using [Select for Print labels] As PrintCount, and Sum(ReviewCount,
PrintCount).

I tried screwing around with some SQL statements, but as I know next to
nothing about SQL statements I've had no luck.
 
I've gotten this far:
SELECT "Print" As Report, Count(*) As Labels FROM [Select for Print labels]
UNION ALL
SELECT "Review" As Report, Count(*) As Labels FROM [Select for Review labels]
;
But I can't figure out how to add a Totals row.
 
Are [Select for Print Labels] and [Select for Review labels] tables or are
they queries against the same table?

If they are queries against the same table, then perhaps you could run a
query against that table. Also, you may be able to use the DCount function
to acheive your goal. On a form or in a report you could use a control with
its source set to

=DCount("*","[Select for Print Labels]") + DCount("*","[Select for Review
labels]")

You could set other controls for the Print and Review counts.


Tergiver said:
I've gotten this far:
SELECT "Print" As Report, Count(*) As Labels FROM [Select for Print
labels]
UNION ALL
SELECT "Review" As Report, Count(*) As Labels FROM [Select for Review
labels]
;
But I can't figure out how to add a Totals row.

Tergiver said:
I know I can query for a count like this:
SELECT Count(*) As ReviewCount FROM [Select for Review labels];

Which gives me the number of records in [Select for Review labels], but
what
I would like is a query that returns 3 fields: The above, the same thing
using [Select for Print labels] As PrintCount, and Sum(ReviewCount,
PrintCount).

I tried screwing around with some SQL statements, but as I know next to
nothing about SQL statements I've had no luck.
 

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

Back
Top