SQL, Count and subqueries

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Garrett Kajmowicz

    #1

    SQL, Count and subqueries

    Here is the situation:

    I have one table that lists a number of courses available (including
    CourseID, CourseName and MaxPositions), with CourseID being auto_increment
    and unique

    I have another table which has CourseRegistrat ion (Containing CourseID and
    CustomerID), with no unique fields. Customer information is stored
    elswhere.

    Without having a field in the Courses table holding the number of people
    currently registered, how would I return a result set which included:

    CourseID, CourseName, MaxPositions and the Number of people registered to
    take that course.

    Preferably this would not use features in MySQL 4.1, but anything is fair
    game at this point.

    Thank you for all of your help.

    Garrett Kajmowicz
    gkajmowi@tbayte l.net
Working...