关于oracle sql的问题

ZeroJ 发布于 2012/04/15 17:45
阅读 217
收藏 0
想列出选课超过大于等于三个的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

加载中
0
hulubo
hulubo
SELECT studID, preferredName, familyName, count(*)  
FROM student JOIN studentUnit USING (studID) 
JOIN unit USING (unitID) 
WHERE  studid in ( 
SELECT  studID 
FROM student JOIN studentUnit USING (studID) 
JOIN unit u USING (unitID) 
GROUP BY studID  
HAVING count (*)  >=3); 

返回顶部
顶部