Jump to content

[SOLVED] LEFT JOIN questions


josephman1988

Recommended Posts

Hi guys,

 

I'm only just getting familiar with joing tables.

I have the following 2 table structures.

 

games:

g_id (Primary Key + Auto Increment)
g_title
g_content
g_release
g_image

 

news:

n_id (Pimary Key + Auto Increment)
n_content
n_date
n_image
g_id

 

So I have the following query to match the 2 id's, but How would I grab the associated g_title.

 

This is my attempt:

SELECT games.g_title, news.n_title, news.n_image, news.n_date, news.n_content, news.g_id
		FROM games
		LEFT JOIN news
		ON games.g_id = news.g_id
		ORDER BY n_id DESC

 

Hope you can help and explain =]

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.