Jump to content

DISTINCT using two tables?


Mr Chris

Recommended Posts

Hi All,

 

I have two tables, a table called gallery, and a table called info

 

Now both have a field called gallery_id

 

Now in the gallery table the field gallery_id has lots of the same value ie: 5 so I want to get the DISTINT value, but the output displays the same value 5 in multiple rows.

 

SELECT DISTINCT i.info_id, g.gallery_id, g.main_name, i.opening, i.headline, DATE_FORMAT(i.published, '%W, %D %M, %Y') AS formatted_date, i.gallery_id
FROM gallery g, info i
WHERE g.gallery_id=i.gallery_id

 

Can anyone help?

 

Thanks

 

Chris

Link to comment
https://forums.phpfreaks.com/topic/120208-distinct-using-two-tables/
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.