I'm tired and I can't wrap my head around this. I have two tables:
table menu
@id = id, @nr = id of parent
|======|======|
| id | nr |
|======|======|
| 10 | 9 |
| 11 | 10 |
| 12 | 10 |
| 13 | 10 |
|======|======|
table content
@id = id, @mf = menu - first in tree, @mi = menu item linked to content
|======|======|======|
| id | mf | mi |
|======|======|======|
| 85 | 9 | 11 |
| 89 | 9 | 12 |
| 95 | 9 | 13 |
|======|======|======|
Now, I need to select all rows from content
, where (mi
= menu
.id
), but i need to select menu
.id
from menu
first by selecting *
from menu
where nr
= 10 (or any number, which I put to my sql with PHP)
I really can't wrap my head around all those UNIONS, LEFT JOINS, HAVING and stuff...
Thank you
Edit: Thank you ALL, shame I can pick just one good :)