Skip to content

Instantly share code, notes, and snippets.

@decebal
Created April 17, 2012 09:09
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 decebal/2404772 to your computer and use it in GitHub Desktop.
Save decebal/2404772 to your computer and use it in GitHub Desktop.
Sorting values separately as string or numeric
SELECT test_col, SUBSTRING_INDEX(test_col, '', 1) as test_col_str,
SUBSTRING_INDEX(test_col, ' ', -1) + 0 as test_col_num FROM test ORDER
BY test_col_str, test_col_num;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment