我尝试了以下查询..但它无效
SELECT course_id as a,
sub1 as (SELECT subj1
FROM stu_subject
WHERE course_id = a.course_id),
sub2 as (SELECT subj2
FROM stu_subject
WHERE course_id = a.course_id),
sub3 as (SELECT subj3
FROM stu_subject
WHERE course_id = a.course_id)
FROM stu_mark_list
WHERE course_id=(SELECT course_id
FROM stu_mark_list
WHERE course_id = a.course_id)
答案 0 :(得分:0)
SELECT course_id as a
,(SELECT subj1 FROM stu_subject WHERE course_id=a.course_id) as sub1
,(SELECT subj2 FROM stu_subject WHERE course_id=a.course_id) as sub2
,(SELECT subj3 FROM stu_subject WHERE course_id=a.course_id) sub3
FROM stu_mark_list where course_id=(SELECT course_id FROM stu_mark_list WHERE course_id=a.course_id)
示例:从SomeTable中选择col1,(从myTable中选择前1个abc)作为col2。 在上面的示例中,值取自MyTable,名称以col2。
希望这会对你有所帮助。