Jump to content

[SOLVED] getting all values from three different tables .. JOIN problem?


krio

Recommended Posts

I'm learning mysql and have been trying to get this working, but an error always comes up no matter how I try it - or it just doesn't show anything from the table.

 

I have 3 tables, all with the same amount of columns and name of columns

 

I want to list all the values in alphabetical order by title

 

Tables: General - Temp - Location

 

Columns:  id - url - title - description

 

How would you  write the select statement?

 

I have tried numerous ways and can't figure it out... I'm guessing it would look something like

 

SELECT * FROM General JOIN Temp ON General.title = Temp.title JOIN Location ON Temp.title = General.title

 

I have played around extensively with changing the values like Temp.title = General.title and that doesnt seem to help

 

Any ideas?

 

Thanks!

 

SELECT 
General.id,
General.url,
General.title,
General.description,
Temp.id,
Temp.url,
Temp.title,
Temp.description,
Location.id,
Location.url,
Location.title,
Location.description
FROM 
General INNER JOIN Temp
ON General.id = Temp.id
INNER JOIN Location
ON Temp.id = Location.id
ORDER BY
General.title

 

Will this work?

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.