mds1256 Posted December 20, 2010 Share Posted December 20, 2010 Hello I have the below query pulling data from 2 tables: news - where news is stored newspic - where news pictures are stored (usually many pics for the same news article news table: id title date body newspic table: id newsid picdescription piclink piclinkthumb type Query: SELECT news.id, title, date_format(date, '%D %M %Y' ) as convDate, piclink, SUBSTR(body,1,110) as bodySub from news, newspic where news.id = newspic.newsid order by date desc but it still returns multiple entries for the same article (returns the same news article as many times as their are pics) so what join do i need to do to only return one of each no matter how many pics there are Quote Link to comment https://forums.phpfreaks.com/topic/222210-help-with-joining-query/ Share on other sites More sharing options...
mds1256 Posted December 20, 2010 Author Share Posted December 20, 2010 sorted myself, just came to me... needed to do a group by on news.id Quote Link to comment https://forums.phpfreaks.com/topic/222210-help-with-joining-query/#findComment-1149529 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.