Help with SQL Statement for DRW

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

I need a SQL statement that will display a course number, current number of
registrations for that course, and the current status of the course.

I have the following statement that displays the course# and how many
registrations there are for that course.

SELECT ucourse, count(*) AS theCount
FROM usercourses
GROUP BY ucourse
HAVING count(*) > 1
ORDER BY count(*) DESC;


I need to know what to add to the SQL statement to also display the current
status (cStatus) of the course from another table called (Courselist)

The final output would be displayed in a table.

| CourseId | Current Count | Current Status |

Is this possible?

Dan
 
SELECT a.ucourse, a.count(*) AS theCount, b.status AS Current Status
FROM usercourses a INNER JOIN courselist b on a.ucourse = b.ucourse
GROUP BY ucourse
HAVING count(*) > 1
ORDER BY count(*) DESC;
 
Back
Top