java - Find Nested self referred records in same table -


i have problem find nested self referred records db. how can retrieve nested self referred records mysql database..

consider example below

id refid name value 1   na       10 2   na    b    20 3   1     c    30 (it refering id 1) 4   1     d    40 (it refering id 1) 5   2     e    50 (it refering id 2) 6   3     f    60 (it refering id 3) 7   6     g    70 (it refering id 6)  input --> id=1  output ---> id= 3,4,6,7                   id -> 1                       |-> id 3, 4                              |-> id 6                                      |-> id 7  want find sub levels.... 

now want find self referred nested sub records db...

if want find id=1 means should display sub records of it. i.e wherever refid = 1 , referred id have refid means come display

how can retrieve data db..

is sql query can able retrieve records db

mysql not support recursive queries.

you either create function creates recursion within mysql, or let client code handle issue looping , re-query database deep needed.


Comments

Popular posts from this blog

google api - Incomplete response from Gmail API threads.list -

Installing Android SQLite Asset Helper -

Qt Creator - Searching files with Locator including folder -