从楼主的sql中可以看出, certificate 表参照 electrician 并且通过elecid进行关联.
假如 certificate 表中有一条 elecid =1 的记录, 而 electrician 中没有 elecid=1 的记录,
那么两条语句查询的结果就不同了,select * from certificate inner join electrician on (certificate.elecid=electrician.elecid)
可以查出certificate 所有的记录
而
select * from certificate,electrician where certificate.elecid=electrician.elecid
查不出 elecid =1 的那条记录.可以看出如果是通过主外键关联的表,如果要查refrence表的其它字段, 最好用 join
假如 certificate 表中有一条 elecid =1 的记录, 而 electrician 中没有 elecid=1 的记录,
那么两条语句查询的结果就不同了,select * from certificate inner join electrician on (certificate.elecid=electrician.elecid)
可以查出certificate 所有的记录
而
select * from certificate,electrician where certificate.elecid=electrician.elecid
查不出 elecid =1 的那条记录.可以看出如果是通过主外键关联的表,如果要查refrence表的其它字段, 最好用 join
解决方案 »
免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货