BJ, > I have a MS_SQL query (simplified for this question): > [snip] > > I have another table that contains images for some of the products. > I would like to get back all the products that have or don't > have images. I tried using a RIGHT JOIN but I couldn't get it > working correctly. > > The images use the style_id to identify which style they belong > to. So B.style_id = D.style_id (D being images) > [snip]
You should be ok with a left join. SELECT P.*, S.*, Q.*, I.* FROM Product AS P LEFT JOIN Style AS S ON P.product_id = S.product_id LEFT JOIN Quantity AS Q ON S.style_id = Q.style_id LEFT JOIN Images AS I ON S.style_id = I.style_id ORDER BY P.product,S.style Regards Stephen ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Archives: http://www.houseoffusion.com/cf_lists/index.cfm?forumid=4 Subscription: http://www.houseoffusion.com/cf_lists/index.cfm?method=subscribe&forumid=4 FAQ: http://www.thenetprofits.co.uk/coldfusion/faq This list and all House of Fusion resources hosted by CFHosting.com. The place for dependable ColdFusion Hosting. http://www.cfhosting.com Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4