Sql查询返回0行

时间:2013-06-19 10:13:26

标签: mysql

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

除了'table'之外的其他两个是空的,我已经离开了join但是class table仍然没有显示

1 个答案:

答案 0 :(得分:3)

如果您仅使用join,则默认为inner join

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