1
回答
关于oracle sql的问题
科大讯飞通用文字识别100000次/天免费使用。立即申请   
想列出选课超过大于等于三个的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
发帖于6年前 1回/191阅
顶部