I don't know how to do an SQL recursive query. The database structure is like this:
Name Id Id Parent
Food 0 -1
Pizza 1 0
Pasta 2 0
Pasta with Tomato 3 2
Every Row has a name, an ID (which is the primary key in the table) and a parent id, that is recursive as you can see. If a row doesn't have a parent, then the id is set to -1. In the case of pasta with tomato, I need to take the parent name and, if the parent has a parent itself, I need to take also that name and so on until I reach the root. What is the right recursive query to apply? Thanks to those that will help me!