Jump to content

Archived

This topic is now archived and is closed to further replies.

Mr Chris

Calling data from 3 MySQL tables

Recommended Posts

Hi,

I'm trying in PHP to call out an SQL statement to enter data from 3 tables, now i've done it with two:

[b]
Select * FROM `cms_competitions`
LEFT OUTER JOIN cms_competition_pics
ON cms_competitions.competition_id = cms_competition_pics.competition_id 
WHERE cms_competitions.competition_id=".$_GET['competition_id'],$link);
[/b]

But how do include another table ie cms_competition_logos?

I understood a two table join, but a three i'm confused on?

Thanks

Chris

Share this post


Link to post
Share on other sites
you'd normally do it with commas... FROM member, item, category....
but to do it with a left join, I'm not sure. You might need to use () to encapulate each LEFT OUTER JOIN command and then add a comma and another () to encapsulate another.

Try writing what you want to do in plain english (or your mother language if different) and translate it into pseudo code (semi-logical PHP). That might help.

Share this post


Link to post
Share on other sites
It's alot easier, and in my opinion a lot easier to mantain, to just do 1 db call, then the other db call after that.

Share this post


Link to post
Share on other sites

×

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.