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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Counting Multiple Fields

Status
Not open for further replies.

lilcam

MIS
Apr 22, 2002
52
US
How do I go about counting two fields from two tables?
I need to count the 'Visit No' field from table A(which there are eight rows), and count the 'Test Drive No' from Table B (which there are 25), and take those number and divide them. Do this all in one query. Is that possible?
 
I don't think you can do this in one go. You need to write 3 queries, one each to count the rows in the 2 tables and a third to do the division, ie:

Q1: select count([Visit No]) as Visits from tableA
Q2: select count([Test Drive No]) as Drives from tableB
Q3: select Drives/Visits as myRatio from Q1, Q2 Best Regards,
Mike
 
I thought this would be the case. My professor says it can be done by using two queries. Though I thought it was stupid to do the counting, since the fields I mentioned is an 'Autonumbering' field, and I got it to work by using one query.

Get the MAX number from the two fields and divide them up.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top