Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Nested Queries

Status
Not open for further replies.

CGSB

Programmer
May 23, 2006
35
CA
I am having problems making the following query work the way I intend it to work:

Code:
SELECT serie_no AS sn, STR((SELECT COUNT(standard_id) FROM standard WHERE is_pdf=True AND is_current=True AND serie_no = sn))+'/'+STR((SELECT COUNT(standard_id) FROM standard WHERE is_current=True AND serie_no = sn)) AS serie_pdfs
FROM standard
GROUP BY serie_no;

My intention was to display the amount of records that have is_pdf set to true for each serie_no.

However, when I run this in Access, I get prompted for sn and the total is the same for each serie_no.

If you need further information in order to help me, please let me know.

Thanks in advance


 
SELECT serie_no AS sn, Sum(IIf(is_pdf AND is_current,1,0)) & '/' & Sum(IIf(is_current,1,0)) AS serie_pdfs
FROM standard
GROUP BY serie_no

Hope This Helps, PH.
FAQ219-2884
FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top