Jump to content

Help with joining query


mds1256

Recommended Posts

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

Link to comment
https://forums.phpfreaks.com/topic/222210-help-with-joining-query/
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.