Jump to content

Simple query in Mysql that i can't seem to get right! Joining tables


c_shelswell

Recommended Posts

Hi i'm sure this has a very simple answer. I'm looking to query mysql joining two tables. basically i have:

Media
media_id - title - picture

and

Purchases
media_id - quantity

all im looking to do is query mysql for the title of the media_id i give to it from the purchases table. I'm getting some results but i provides me with the title as many times as the media_id appears in purchases i only need it once.

Here's my code.
[code]select media.title, media.picture from media left join purchases using (media_id) where purchases.media_id='4';[/code]

i'm pretty new to mysql and this is really just a guess if anyone could help that would be great.

Thanks very much
Link to comment
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.