On Thu, 17 Jul 2014 21:28:14 +0800 Arup Rakshit <aruprakshit@xxxxxxxxxxxxxx> wrote: > ORDER BY parent_id, id ? > parent_id .. But why order_by.. I thought I need to group by Perhaps you need to tell us what your problem is instead of your solution. What exactly are you trying to accomplish here? Don't describe it in database terms. Tell us what the real world situation is and what result you want to see. For example; I have a list of people related to each other in a parent/child relationship to any level (e.g. parents, grandparents, etc.) and I want to list everyone who is a descendant of anyone in the database. Try for that level of detail and you will probably get more useful answers. Also, see http://www.catb.org/~esr/faqs/smart-questions.html for some useful hints on asking questions. -- D'Arcy J.M. Cain <darcy@xxxxxxxxx> | Democracy is three wolves http://www.druid.net/darcy/ | and a sheep voting on +1 416 788 2246 (DoD#0082) (eNTP) | what's for dinner. IM: darcy@xxxxxxx, VoIP: sip:darcy@xxxxxxxxx