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!

I'm sure this is easy - my minds gone blank!

Status
Not open for further replies.

addy

Technical User
May 18, 2001
743
GB
OK

I have a table which has the following fields included:

ProjectCode
Contractor

Each ProjectCode can have more than one Contractor assigned to it, for example:

ProjectCode Contractor
001.000 ACME
001.000 J. Smith Construction
001.000 F Bloggs Builders

002.000 ACME
002.000 F Bloggs Builders

etc. etc.

What I want to do, is count how many ProjectCode's a particular Contractor is assigned to. So, for example, if I ran the query for ACME I would get a result of 2, if I ran it for J. Smith Construction, I would get a result of 1.

I'm having a complete blank and have't got anywhere.

Thanks in advance.
 
select count(projCode), contractor from table group by contractor

--------------------
Procrastinate Now!
 

Hi,
Code:
select Contractor, Count(ProjectCode) from ttt
group by Contractor


Skip,

[glasses] [red]Be Advised![/red] A man's home is his castle...
in a Manor of speaking. [tongue]
 
OK, I got it!

Code:
SELECT Count([01tblProjectControl].ProjectNumberCode) AS CountOfProjectNumberCode
FROM 01tblProjectControl INNER JOIN 10tblProjPropEstimateOriginalEQs ON [01tblProjectControl].ControlNumber = [10tblProjPropEstimateOriginalEQs].ControlNumber
WHERE ((([10tblProjPropEstimateOriginalEQs].Contractor)="ACME"));
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top