Article From:https://segmentfault.com/q/1010000011103618
Question:

There is a table structure as follows
id name parentid rank
1 a null 1
2 b null 1
3 c. null. 1

      1. 2

    1. 1 2

      1. 2

      1. 3
        This table is designed to store parent and child items in a table, and now you want to render them as parent and child items by query

1 a null 1
4 d 1 2
5 e 1 2
2 b null 1
6 f 2 2
7 g 6 3
3 c null 1
How does this SQL write

Answer 0:

Deal with the format, I don’t know what to ask

Answer 1:

Re – edit the problem

Answer 2:

wendeWhat can’t be understood

Answer 3:

Do not understand what it means

Answer 4:

You can use the screenshots to express the existing database structure and the expected database structure first.

Leave a Reply

Your email address will not be published. Required fields are marked *