Created
July 8, 2012 23:45
-
-
Save voltechs/3073456 to your computer and use it in GitHub Desktop.
Memberships ordered by the rank of membership's role.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
SELECT `memberships`.* from `memberships` | |
INNER JOIN `groups` ON `groups`.id = `memberships`.group_id | |
INNER JOIN `roles` ON `memberships`.role_id = `roles`.id | |
INNER JOIN `roles` `role_cat` ON `role_cat`.id = `roles`.type_id | |
WHERE `groups`.id = "HHC" AND `memberships`.expiration > CURDATE() | |
ORDER BY `role_cat`.rank DESC, `roles`.rank DESC |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment