It is too late, may be it near to your requirement. select * from (select parent_id,id,category from table_name where parent_id = 1 union select parent_id, id, concat(SPACE(_rowid+1),category) cat from table_name where parent_id <>1) abc order by parent_id, category_id ________________________________ From: php-objects@xxxxxxxxxxxxxxx [mailto:php-objects@xxxxxxxxxxxxxxx] On Behalf Of Reji Jayan Sent: 23 September 2009 11:12 To: php-objects@xxxxxxxxxxxxxxx Subject: Simple Query Help me to get a query to display like this Category Subcategory Subcategory Subcategory ------------------ ------------------- ---------------- (n) Category Subcategory Category Category table --------------------- id Category_id Parent_id I hope u all got this .. Expecting reply -s .. Thanks in advance. Thank You, Reji Yahoo! India has a new look. Take a sneak peek http://in.yahoo.com/trynew [Non-text portions of this message have been removed] [Non-text portions of this message have been removed]