Hey guys, been messing with this for a while, getting close but still not getting the results I need. I have two tables, pages, and sections.
Pages looks like this:
id | parent_id | page_number
id | parent_id | page_id | type | etc
I need to select all sections where the parent_id = 1 and also include the page_number for all sections where sections.parent_id = pages.parent_id
This is what I have:
This works but I get duplicates..Currently there are 3 pages, I seem to get a duplicate section for each page..Code:SELECT * FROM (`sections`) INNER JOIN `pages` ON pages.parent_id = sections.parent_id WHERE sections.parent_id = '1' ORDER BY sections.id ASC
I have also tried LEFT JOIN, etc..
Thanks..any help is appreciated.