您好,登錄后才能下訂單哦!
場景
????????在查詢學生信息中,允許學生宿舍信息為空,如果有獲取,沒有為空
select t.*, cs_sc_studenthostel.name as hostelname
from (
select cs_sc_student.id as student_id,
cs_sc_student.name as studentname,??
cs_sc_class.name as classname,?
cs_sc_student.sc_studenthostel_id??
from cs_sc_student, cs_sc_class?
where cs_sc_student.sc_class_id = cs_sc_class.id) t
left join cs_sc_studenthostel on t.sc_studenthostel_id = cs_sc_studenthostel.id
第一步 獲取到學生的基礎信息
(
select cs_sc_student.id as student_id,
cs_sc_student.name as studentname,??
cs_sc_class.name as classname,?
cs_sc_student.sc_studenthostel_id??
from cs_sc_student, cs_sc_class?
where cs_sc_student.sc_class_id = cs_sc_class.id) t
第二步 進行左連接
left join cs_sc_studenthostel on t.sc_studenthostel_id = cs_sc_studenthostel.id
免責聲明:本站發布的內容(圖片、視頻和文字)以原創、轉載和分享為主,文章觀點不代表本網站立場,如果涉及侵權請聯系站長郵箱:is@yisu.com進行舉報,并提供相關證據,一經查實,將立刻刪除涉嫌侵權內容。