Original Post
I seem to suck at SQL, perhaps I should read some tutorials again. However, that doesn't get me much further for now, so perhaps someone else here can help me. I have 2 tables, MenuCat and Menu.
MenuCat:
ID Prim key, int, auto_increment
CatType varchar(30), not null
Menu:
MenuID prim key, int, auto_increment
CatID int, unsigned, null (Used by parent item)
PID int, null (Linked to MenuID by child item)
Name varchar(20), not null
URL varchar(255), not null
Now, I want to create my menu from this in PHP. The PHP is the easy part, but I can't seem to figure out how to form my query to grab my menu. I want to know the CatType, menuid, name, etc. I used a recursive menu table to keep it less complicated then having 2 menu tables(A Parent and child table). I tried this query, but MySQL chokes on it
SELECT *
FROM Menu
WHERE Menu.MenuID
IN (
SELECT DISTINCT Menu.PID
FROM Menu
WHERE Menu.PID IS NOT NULL
)
GROUP BY MenuID
LIMIT 0 , 30
Any help?