没有图片的我的产品没有显示,我想在各种条件下展示产品 [英] my product which have no Picture is not display, I want to display products in every condition
问题描述
我的查询是:
使用SoftBusinessPoint;
SELECT Product_tbl 。*,Picture_tbl.Image
来自Picture_tbl
INNER JOIN Product_tbl
ON Picture_tbl.ProductID = Product_tbl.ProductID AND Picture_tbl.Status ='PImage前面'
其中Product_tbl.UserName ='muneerhussan'和Product_tbl.PageID = 15订购者来自Upload_DateTime DESC;
my Query is:
use SoftBusinessPoint;
SELECT Product_tbl.*,Picture_tbl.Image
FROM Picture_tbl
INNER JOIN Product_tbl
ON Picture_tbl.ProductID = Product_tbl.ProductID AND Picture_tbl.Status = 'PImage Front'
where Product_tbl.UserName='muneerhussan' and Product_tbl.PageID=15 order by Upload_DateTime DESC;
推荐答案
你需要一个< a href =https://technet.microsoft.com/en-us/library/ms187518%28v=sql.105%29.aspx>左连接 [ ^ ]从产品到图片。
You need a left join[^] from product to picture.
SELECT Product_tbl.*,Picture_tbl.Image
FROM Product_tbl
LEFT JOIN Picture_tbl
ON Picture_tbl.ProductID = Product_tbl.ProductID AND Picture_tbl.Status = 'PImage Front'
where Product_tbl.UserName='muneerhussan' and Product_tbl.PageID=15 order by Upload_DateTime DESC
这将拉动所有产品,甚至那些没有图像的产品。在这种情况下,image列将为null。
This will pull all products, even those where there is no image. In that case the image column will be null.
这篇关于没有图片的我的产品没有显示,我想在各种条件下展示产品的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!