I have an SQL question. I am using the following code:


SELECT p1.P_ID, c2.Cat_ID, p1.P_Name, i3.ImageTNFileName AS TNName,
c2.CPR_Seq_Number

FROM categoryproducts c2, products p1

LEFT JOIN (Image i3) ON (i3.ImageTypeID=p1.P_ID)

WHERE (c2.Cat_ID=180 AND p1.P_Disable IS NULL) AND ((c2.P_ID=p1.P_ID))

GROUP BY i3.ImageTypeID

ORDER BY C2.CPR_Seq_Number ASC, i3.ImageSeqNumber ASC



The Image table may contain multiple, one or no images for each product. The
SQL works fine for products with one or more images. But if the product has
no images, it is not returned in the SQL result. If I remove the "GROUP BY",
it includes products with no or one image, but products with multiple images
result in a row for each image.



Can I modify this SQL to include one row for each product with no images,
one image and multiple images. AND the image for products with multiple
images should be the one with the smallest ImageSeqNumber.



Thanks in advance for your time.



Steve Fogelson



----------------------------------------

To unsubscribe from this list, please send an email to [email protected] 
with "unsubscribe witango-talk" in the body.

Reply via email to