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

Comparing and Counting fields in two tables

Status
Not open for further replies.

squishiful

Programmer
Feb 23, 2006
2
US
I am new to Access. I have very little of an idea of what I am doing. Okay, here goes...

What I have is two tables
One with customer info I need to compare the ID field to another table so I'll only show that field.
Code:
ID
--
1
2

I have another table with jobs I've done this has a for field that tells the ID of the customer this job was for, I'm not sure if you'll need the ID of these but I'll show it anyway.
Code:
ID FOR
-- ---
1   1
2   1  
3   2

I now want to compare the two tables and find out how many jobs I've done for each customer so I want the output to be sumthing like:
Code:
CUSTOMER JOBS
-------- ----
   1      2
   1      1
Is there anyway that I can do this?
Thank you!
 
SELECT FOR AS Customer, Count(*) AS Jobs
FROM [table with jobs]
GROUP BY FOR

Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ181-2886
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top