Answers for "list tables in sorted order parent to chiled mysql"

SQL
0

order child below the parent in mysqli

# If no-parent = 0 instead of null 
SELECT CONCAT(IF(parent = 0,'',CONCAT('/',parent)),'/',id) AS gen_order
FROM table 
ORDER BY gen_order

#and if no-parent = null
ORDER BY COALESCE(parent, id), parent IS NOT NULL, id
Posted by: Guest on June-29-2020

Code answers related to "list tables in sorted order parent to chiled mysql"

Code answers related to "SQL"

Browse Popular Code Answers by Language