I am having one category table where i want to give category for posts
post_category(cat_id,cat_name,parent_id,cat_count)
cat_id cat_name parent_id cat_count
1 C NULL 300
2 Pointers 1 100
3 Structures 1 200
4 Java NULL 700
5 Exceptions 5 200
6 Threading 5 300
7 Thread Priority 6 200
here cat_id is primary key and parent id for root elenemts are null and for child parent id is any valid cat_id. I want to select each parent and its child details. as follows
C
Pointers
Structures
Java
Exceptions
Threading
Thread priority