Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.