Click here to Skip to main content
15,886,110 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
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;
Posted

1 solution

You need a left join[^] from product to picture.
SQL
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

This will pull all products, even those where there is no image. In that case the image column will be null.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900