deansatch Posted September 28, 2011 Share Posted September 28, 2011 I have 2 tables. 1 table is 'adverts' and the other table is images. There are multiple images per advert and each image has a column 'advertID' to map it to the correct advert. I am having trouble doing a SELECT statement which to get each advert and it's related images. So far I have tried this but I end up with more images than there should be. SELECT * FROM saleadvert a, images b WHERE b.type = 'sale' AND a.clientID='$clientID' AND a.id = '$advertID' Any help appreciated. The selecting from multiple tables always does my head in! Link to comment https://forums.phpfreaks.com/topic/248052-select-from-2-tables-at-same-time/ Share on other sites More sharing options...
deansatch Posted September 28, 2011 Author Share Posted September 28, 2011 Never mind. I was just being thick! Should have been b.advertID not a.id Link to comment https://forums.phpfreaks.com/topic/248052-select-from-2-tables-at-same-time/#findComment-1273641 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.