0
我正在使用第一個層次表中的數據列在第二個層次表上執行下一個查詢。從第一層次結果查詢數據以查詢第二層次數據
1日查詢(從課程表) - 第一層次:
「Select course_id, record_id from Courses」
比方說,如果我們得到這個結果:
course_id | record_id
1417 | 555555
2203 | 444444
3765 | 222222
我想用數據COURSE_ID從得到第一個查詢作爲索引進行下一個查詢。
第二查詢(從第表) - 第二層次:
不知道這將是把邏輯一起最好的查詢。
這裏有一些疑問的,我試過:
「Select section_id, course_id from Sections where course_id in ...?
"Select course_id from (select course_id from Courses) as cid from Sections.." ?
我能做到這一點?
"Select section_id, course_id from Sections where course_id = (select course_id FROM Courses)" ?