nix, shell, perl, php, mysql and mac os x tips and tricks

Friday, October 24, 2003

MySQL to show an entire category tree

01.SELECT a.category_name AS parent_name,
02.b.category_name AS child_name,
03.a.category_code as a_category_code,
04.a.category_parent AS a_category_parent,
05.b.category_code as b_category_code,
06.b.category_parent AS b_category_parent
07.FROM categories_raw_loop AS a, categories_raw_loop AS b
08.WHERE a.category_code = b.category_parent
09.ORDER BY a.category_code;

No comments:

Post a Comment