|
Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com |
From: Elim PDT (elim
pdtnetworks.net)
Date: Thu Jul 16 2009 - 00:20:52 CDT
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
My table group_member looks like this:
+-----------+-------+---------+
| member_id | name | head_id |
+-----------+-------+---------+
| 1 | Elim | NULL |
| 2 | Ann | 1 |
| 3 | David | NULL |
| 4 | John | 3 |
| 5 | Jane | 3 |
+-----------+-------+---------+
Record with null head_id means
the member is a group head.
Record with head_id k are in the
group with head whoes id equals k.
I like to fetch the rows in the following ordaer
| 3 | David | NULL |
| 4 | John | 3 |
| 5 | Jane | 3 |
| 1 | Elim | NULL |
| 2 | Ann | 1 |
That is
(1) A head-row follewed by the group members with that head
(2)head rows are ordered alphabetically by name.
What the query looks like?
Thanks
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]