Forum Moderators: open

Message Too Old, No Replies

SQL Statement Needed

         

kevinj

9:03 pm on Dec 8, 2003 (gmt 0)

10+ Year Member



I have two tables (Exhibitors and Badges) linked by a common field named exhibitor_id. I need a SQL query statement that will give me

1. Exhibitor Name (exhibitor_name) from the Exhibitors table
2. A count of the number of times each exhibitor's exhibitor_id appears in the Badges table.

So it would look something like

Exhibitor Name Number of Badges
Company 1 20
Company 2 13

Thank you.

tomasz

9:20 pm on Dec 8, 2003 (gmt 0)

10+ Year Member



SELECT Exhibitors.exhibitor_name , COUNT(Badges.exhibitor_id ) AS TotalBadges
FROM Exhibitors INNER JOIN
Badges ON Exhibitors .exhibitor_id = Badges.exhibitor_id
GROUP BY Exhibitors.exhibitor_name

kevinj

9:45 pm on Dec 8, 2003 (gmt 0)

10+ Year Member



Thanks tomasz! Worked perfect.