Skip to content

Instantly share code, notes, and snippets.

What would you like to do?
find distribution of value lengths for a given field
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;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment