您好,欢迎访问一九零五行业门户网

关于数据库查询问题

select a.*,b.`description` 
from `1_sku_comparison` a,`1_product` b 
where a.`sku`='6007-00d' 
and a.`item_code`=b.`item_code`
以上语句如果`1_product`没有相应的`item_code`就会导致整个语句结果为空,请问有什么方法,不要因为`1_product`.`item_code`没有相应的值,而导致整个结果为空,因为我主要是要查`1_sku_comparison`这个表的数据,1_product有没有没关系。
回复讨论(解决方案) 左连接
select a.*,b.`description` 
from `1_sku_comparison` a  left join `1_product` b on a.`item_code`=b.`item_code`
where a.`sku`='6007-00d'
其它类似信息

推荐信息