I have a mysql table as follows:
id | name | parent_id
19 | category1 | NULL
20 | category2 | 19
21 | category3 | 20
22 | category4 | 21
How do i write a recursive mysql query to fetch all the nodes from input node to root node. E.g: If the input is category3, the output should be category3, category2 and category1