MySQL Forums
Forum List  »  Newbie

Just found out I cannot use WITH
Posted by: John Coakley
Date: January 29, 2018 01:09PM

This is the problem I am working on:
Find the enrollment of each section (number of students enrolled) that was offered in Spring 2010.

This is the query that I created, but it flags the WITH statement, is there an alternative to this to get working?

USE JACLLC;
SET SQL_SAFE_UPDATES = 0;
WITH sec_enrollment AS (
SELECT course_id, count(ID) as enrollment
FROM section NATURAL JOIN takes
WHERE semester = 'Spring'
AND year = 2010
GROUP BY course_id,sec_id
SELECT course_id, sec_id
FROM sec_enrollment
WHERE enrollment = (SELECT MAX(enrollment) from sec_enrollment

Options: ReplyQuote


Subject
Written By
Posted
Just found out I cannot use WITH
January 29, 2018 01:09PM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.