简体   繁体   中英

Sql query returns 0 rows

SELECT * FROM class c 
Left join sub_inclass s on s.class_id=c.class_id 
join subject sb on  s.sub_id=sb.sub_id

The other two except class 'table' are empty, I have left join but class table is still not displaying

If you use only join it is an inner join by default.

SELECT * FROM class c 
Left join sub_inclass s on s.class_id=c.class_id 
left join subject sb on  s.sub_id=sb.sub_id
 ^-------------------you missed left here

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM