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! Quote 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 Quote 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
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.