KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
With the following sql statement I can get all unique values with their counts for a given column: select column, count(column) as count from table group by column order by count desc; How would I get all unique pairs of values with counts. For instance if I had a table of with columns first_name and last_name, I might find results something like this: first_name | last_name | count John | Smith | 42 John | Johnson | 39 David | Smith | 37 etc... Can I do this in basic SQL? I generally use MySQL, but I assume whatever solution you come up with should be translatable to any db.
Tags (comma-separated)
Save Edits
Cancel