php - Mysql query to get parent details in a single query -


I have a table where I store categories with my parent ID. Without a PHP recursion, in order to get the details of parents and ID4, what I want to do is table structure is

  id | Category name | Parent 1 Web 2 2 Software 0 3 PHP 1 4 array 3    

Joining yourself Should be sufficient here, in relation to the line of your parents relating to the main claims of your target table, parents , is to be included in the table against themselves.

Tablename parent on me.parentid = parent.id where i.id = 4

Comments

Popular posts from this blog

mysql - BLOB/TEXT column 'value' used in key specification without a key length -

c# - Using Vici cool Storage with monodroid -

python - referencing a variable in another function? -