Help with SQL Statement for DRW

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
 
M

MD Websunlimited

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;
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top