Skip to content

Instantly share code, notes, and snippets.

@ilhanyumer
Created May 14, 2014 08:30
Show Gist options
  • Save ilhanyumer/3b34d557bb0971ccacef to your computer and use it in GitHub Desktop.
Save ilhanyumer/3b34d557bb0971ccacef to your computer and use it in GitHub Desktop.
order by unique given name
SELECT
COUNT(*),
SUBSTRING_INDEX(`fullname`, ' ', 1)AS givenname
FROM
studentstable
GROUP BY
givenname
ORDER BY
COUNT(givenname);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment