I have this member table where memberships are either single or family, and if family they can be family head or dependent. When outputting a view of the membership, it currently sorts alpha ascending, but I'd like to find a way to put all of the dependents of a family head below the head.
The relevant columns are:
isFam ( tinyint(1) ) isFamHead ( tinyint(1) ) memKey ( int(11) )
Is there some way, in a mysql query, to sort the table alphabetically for single members and family heads, but put the dependents of the family head directly beneath the family head?
(This sort of works right now if all family members have the same last name, but in many cases I find they don't. And different families can have the same last name as well, so ...)
From the comments:
memKeyidentifies a membership. For a single membership, there will be only one row with that
memKey; for a family membership, all members of a given family will have the same
- For a single membership,
isFamis 0; for all members of family memberships,
- The "family head" of each family membership has
isFamHead= 1; there should only be one row where
isFamHead= 1 per
memKey. (Ignore value of
isFamHeadfor single members)