Copy link to clipboard
Copied
This SQL query results in zero out of 268 records due to the criteria of (((Products.ProductFamily)<=0))
SELECT images.url_img, images.alt_img, images.productid_img, Products.ProductFamily, Products.ID
FROM images LEFT JOIN Products ON images.productid_img = Products.ID
WHERE (((Products.ProductFamily)<=0));
However, if you change the <=0 to >0, the correct 140 out of 268 records show up. So if 140 records are greater than zero, shouldn't the remaining 128 records be less than or equal to zero? How do I get the results that are <=0 to show up?
FYI - Products.ProductFamily data type is numeric, field size is integer, decimal places is auto, default value is 0, required is No, indexed is No
Copy link to clipboard
Copied
Question. Why are you using an outer join? Are there cases where you have an image record and no related product record?
Copy link to clipboard
Copied
I've changed the join type but the problem still persists.
Copy link to clipboard
Copied
Yes, but can you still answer the question? I am trying to determine if the problem is in the join or the where clause. What happens if you remove the join and still include results from the product table? Can you give an example of data for a few rows (both tables) that are not working as expected?
Find more inspiration, events, and resources on the new Adobe Community
Explore Now