您好我正在試圖即興我的查詢來獲得更好的performance.Is任何其他方式寫我的SQL.The問題如下。調整我的SQL查詢
SELECT DISTINCT A.name as name,
A.gender as gender
FROM
(
SELECT *
FROM Students S,
Enrollment E,
Group1 G,
Ingroup I
WHERE S.sid = E.sid
AND S.sid = I.sid
AND I.gid = G.gid
)A,
(SELECT *
FROM Students S,
Enrollment E,
Group1 G,
Ingroup I
WHERE S.sid = E.sid
AND S.sid = I.sid
AND I.gid = G.gid
AND S.name="Andrew Peers"
) B
WHERE A.dept = B.dept
AND A.cid = B.cid
AND A.gid = B.gid;
什麼是cid?啊,似乎是course_id –
是的cid是課程編號 – Teja