1
回答
关于oracle sql的问题
开发十年,就只剩下这套Java开发体系了   
想列出选课超过大于等于三个的unit 
写的语句如下:
SELECT studID, preferredName, familyName, count(*) 
FROM student JOIN studentUnit USING (studID)
JOIN unit USING (unitID)
WHERE  studid in (
SELECT  studID, count (*) 
FROM student JOIN studentUnit USING (studID)
JOIN unit u USING (unitID)
GROUP BY studID 
HAVING count (*)  >=3);

提示第5行值过多 这个怎么解决?
表格的结构如下:
1. studentUnit: studID, unitID, semID
2. lecturerUnit: staffID, unitID, semID
3. student: studID, familyName, givenName, preferredName, major
4. lecturer: staffID, familyName, givenName, preferredName, title, faculty
5. unit: unitID, name, credits, faculty
6. school: code, name, faculty
7. semester: semID, name, commence, finish

举报
ZeroJ
发帖于7年前 1回/215阅
顶部