例如:查询所有学生的选课情况
Oracle写法:
SELECT s.SNAME,st.COURSE FROM tt_student s,(SELECT sc.SNO,wmsys.wm_concat(tc.CNAME) COURSE FROM SC sc INNER JOIN tt_course tc ON tc.CNO = sc.CNO GROUP BY sc.SNO) st WHERE s.SNO = st.SNO
MysqL写法:
SELECT s.SNAME,group_concat(tc.CNAME) COURSE FROM SC sc INNER JOIN tt_course tc ON tc.CNO = sc.CNO GROUP BY sc.SNO) st WHERE s.SNO = st.SNO