mysql重点テーマ--「01」課程が「02」課程より成績の高い学生の情報と課程点数を照会する
1327 ワード
-1、「01」課程が「02」課程より成績が高い学生の情報と課程点数を調べる
私の答え:
标题:
私の答え:
select
st.*,
sc.s_score ' ',
sc2.score2 ' ',
inner join score sc on sc.s_id =st.s_id and sc.c_id='01'
inner join score sc2 on sc2.s_id =st.s_id and sc2.c_id='02'
where sc.s_score> sc2.s_score
标题:
SELECT
st.*,
sc.s_score AS ' ',
sc2.s_score AS ' '
FROM
student st
LEFT JOIN score sc ON sc.s_id=st.s_id AND sc.c_id='01'
LEFT JOIN score sc2 ON sc2.s_id=st.s_id AND sc2.c_id='02'
WHERE sc.s_score>sc2.s_score