I am terrible at writing SQL Statements. I never can remember which JOIN to use and what the syntax is...
I'm trying to get all items from table MARKET and only items with matching IDs and have a primary of 1 in MKT_PHOTOS
this is what I have, but I don't think it's right:
_______________
_brian.
I'm trying to get all items from table MARKET and only items with matching IDs and have a primary of 1 in MKT_PHOTOS
this is what I have, but I don't think it's right:
Code:
SELECT *, DATE_FORMAT(market.added,'%b. %e, %Y') AS disp_date FROM market LEFT JOIN mkt_photos ON market.itemid = mkt_photos.itemid AND mkt_photos.primary = '1' WHERE market.sold <> '1' AND market.visible <> '0' AND DATE_FORMAT(market.added,'%U') >= (DATE_FORMAT(market.added,'%U')-2) ORDER BY market.added DESC
_______________
_brian.