08-24-2008, 05:05 PM
|
#4 (permalink)
|
|
is cute and cuddly
Join Date: Mar 2008
Location: Vegas, Baby
Posts: 963
Thanks: 31
|
SQL Join
Example:
Code:
SELECT parent.name AS parent, category.name AS category, page.name AS page
FROM pages_table AS page,
LEFT JOIN categories_table AS category
ON page.categoryid = category.categoryid
LEFT JOIN parent_table AS parent
ON category.parentid = parent.id
You'll have to modify the above query to reflect the proper table and column names before it'll work. It's a pretty generic join too, you may want to look into the link above it and see if there's something that suits your taste or needs a little more closely - the above should give you a result set with 3 columns, and a row for every page that's in your database. Each row will include a column detailing which category that page belongs to, and in turn what parent category that belongs to. How you display the output is up to you, but all the data should be there to do it however you like.
-m
|
|
|
|