Re: Remove duplicate rows and order by number of occurences

From: Mike Ellsworth <younicycle(at)gmail(dot)com>
To: pgsql-novice(at)postgresql(dot)org
Subject: Re: Remove duplicate rows and order by number of occurences
Date: 2009-01-29 17:27:09
Message-ID: 219951fd0901290927y4f6411c2l225d5409bb85a16d@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-novice

> I thought that this might be the solution:
>
> SELECT file_id FROM temp_tagged;
> GROUP BY file_id
> ORDER BY count (file_id) DESC;
>
> But apparently, it isn't.
>
> Any help would be appreciated.
>

Try
SELECT file_id, count(file_id) FROM temp_tagged GROUP BY file_id ORDER
BY count(file_id) DESC

In response to

Browse pgsql-novice by date

  From Date Subject
Next Message Carol Walter 2009-01-29 18:57:28 Re: Remove duplicate rows and order by number of occurences
Previous Message Oliveiros Cristina 2009-01-29 17:21:08 Re: Remove duplicate rows and order by number of occurences