Created
December 9, 2015 23:58
-
-
Save mrowles/ed00cd982fe3cbb9bc26 to your computer and use it in GitHub Desktop.
Get longest first word in column
This file contains 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 SUBSTRING_INDEX( `field_name` , ' ', 1 ) AS `field_name_first_word` | |
FROM `table_name` | |
ORDER BY LENGTH(`field_name_first_word`) desc; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment