Jump to content

[SOLVED] MySQL LEFT JOIN help, connecting 2 tables


Demonic

Recommended Posts

Alright I created this sql query and trying to figure out whats the easiest way to connect two tables.

 

One table is categories, Second is forums

 

$sql = mysql_query("SELECT m.title as `cat_title`, m.order as `cat_order`, f.* FROM categories m JOIN forums f ON f.cid = m.id");

 

This returns the category 3 times, but the 3 child forums are in each query, Will I have to make a function to organize the array? so the category won't repeat multiple times.

 

Also I want to know how can I do multiple joins, because I want to join child forums names in the same query to minimize the code from using a lot of queries.

 

Is this possible?

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.