Skip to content

Instantly share code, notes, and snippets.

@brandonjjon
Created June 16, 2016 19:11
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save brandonjjon/f57de19fc823b119fecdee3c2767e942 to your computer and use it in GitHub Desktop.
Save brandonjjon/f57de19fc823b119fecdee3c2767e942 to your computer and use it in GitHub Desktop.
SELECT SQL_CALC_FOUND_ROWS DISTINCT wpit_connections.*, CASE `entry_type` WHEN 'individual' THEN `last_name` WHEN 'organization' THEN `organization` WHEN 'connection_group' THEN `family_name` WHEN 'family' THEN `family_name` END AS `sort_column` FROM wpit_connections INNER JOIN wpit_connections_meta ON ( wpit_connections.id = wpit_connections_meta.entry_id ) WHERE 1=1 AND wpit_connections.visibility IN ( 'public', 'private' ) AND wpit_connections.status = 'approved' AND ( wpit_connections_meta.meta_key = 'wabw_wall_of_honor' ) GROUP BY wpit_connections.id ORDER BY sort_column, last_name, first_name LIMIT 20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment