Hi.....
I have a table as follows:
section_id
section_parent_id
section_name
And another one,
product_id
product_section_id
product_name
product_price
product_info
And I use the section table to store values for the product's sections, like
section | product
computers | disk drive
flowers | daisys
and so on.
The question is, sometimes I need a section to be within another section, like
computers -> hardware -> (products)
That's why I use the section_parent_id field, to store a section's parent section.
All fine until I need to select the results from the section table and in the ones that have the parent_id appear with that parent's name, like
id | parent | name
1 | 0 | some
2 | 0 | stupid
3 | 1 | stone
4 | 2 | thing
Would appear has
1 | 0 | some
2 | 0 | stupid
3 | some | stone
4 |stupid| thing
How does the SQL Query for something like this look ?
Thanks.