Jump to content

select from 2 tables at same time


deansatch

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.