Jump to content

[SOLVED] inner join


40esp

Recommended Posts

Im trying to query mysql with two inner join statements.

 

Currently I have:

 

SELECT * FROM careers

INNER JOIN practice_groups

ON careers.practice_id = practice_groups.group_id

INNER JOIN offices

ON careers.office_id = offices.office_id

WHERE career.career_id = 1

ORDER BY 'date' DESC

 

But mysql is throwing errors, I've tried parenthesis, but that didn't work, I probably put them in the wrong place.

 

Any Ideas?

Link to comment
https://forums.phpfreaks.com/topic/110161-solved-inner-join/
Share on other sites

i think you are i na wrong forum.. .there's a separate forum for MySQL. though i dont have that modo powers to move threads.

 

anyway... what error did it show?

 

in your query:

 

SELECT * FROM careers

INNER JOIN practice_groups

ON careers.practice_id = practice_groups.group_id

INNER JOIN offices

ON careers.office_id = offices.office_id

 

-- instead of career.career_id, you forgot 's'

WHERE careers.career_id = 1

 

-- date is a keyword for mysql so avoid using it

-- also, specify which table 'date' field belong, it might be ambiguous to other 'date' fields you have

ORDER BY 'date' DESC

 

Link to comment
https://forums.phpfreaks.com/topic/110161-solved-inner-join/#findComment-565346
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.