I have query:
select id, name from categories where parent_id in (
select id
from categories
where top_main_place > 0
)
it selects child info (outer select) of their parent nodes (inner select)
the problem is: I don’t need to have all child nodes data, maximum 6 child nodes data per parent id
how can I reach this result?
btw, sorry for my poor english
You should order the outer query by parent_id, give each row a row number (resetting the row number whenever parent_id changes) and then filter out any row with row number greater than 6, check out this question for example and sql code.