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

Counting Number of repeats in a Colum of Data 1

Status
Not open for further replies.

NewbieDBA

MIS
May 1, 2001
17
US
Hi
I am new at this and I am trying to create a query where I find customers who have registered for three or more of our meetings in a five year period and I am getting bogged down in complexity. My core issue (may be simple) how can I create a count out of the Meeting column in the Metting_Registrant table so that I can find >3 and then (I think) a Union to return the other info form the Customer and Phone tables? Sorry I am so new and may be asking really obvious things. Any hints on where to begin?

Thanks
Newbie DBA
 
If I understand what you are after, try:

[tt]select CustomerID, count(*)
from CustomerMeetings
group by CustomerID
having count(*) >= 3[/tt] Robert Bradley
teaser.jpg

 
Try something like this:

Select r.CustID, r.MtgCnt, c.CustAddress, c.CustContact, p.CustPhone
From (Select CustID, MtgCnt=Count(*)
From RegistrantTbl Group By r.CustID Having Count(*)>2) As r
Join CustomerTbl As c On r.CustID=c.CustID
Join PhoneTbl As p on r.CustID=p.CustID
Terry
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top