Last active
August 29, 2015 13:57
-
-
Save dannguyen/9921769 to your computer and use it in GitHub Desktop.
find distribution of value lengths for a given field
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
SET @field_name = "place_of_service"; | |
SET @tablename = "payments"; | |
SET @query = CONCAT('SELECT ', @field_name, ', count(1), length(', @field_name, ') AS lt FROM ', @tablename,' GROUP BY ', @field_name, ' ORDER BY lt desc'); | |
PREPARE stmt FROM @query; | |
EXECUTE stmt; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment