Wednesday, 11 September 2013

How do I: ORDER BY COUNT(column1) from the result of: SELECT DISTINCT column1, column2

How do I: ORDER BY COUNT(column1) from the result of: SELECT DISTINCT
column1, column2

Because the title is probably bad, and I'm very weak with SQL, I'll try to
clarify my goal:
if:
SELECT DISTINCT host, author FROM t;
Looks like:
foo.com | John
bar.com | Bob
bar.com | Alice
How do I get results like:
foo.com | 1
bar.com | 2
Let me know if this isn't clear enough, and I will update, or respond to
comments.

No comments:

Post a Comment