finding duplicate numbers in a select distinct statement - Mailing list pgsql-general

From Terry
Subject finding duplicate numbers in a select distinct statement
Date
Msg-id 8ee061011003030649q4014c591k880fa81366457c36@mail.gmail.com
Whole thread Raw
Responses Re: finding duplicate numbers in a select distinct statement  (Grzegorz Jaśkiewicz <gryzman@gmail.com>)
List pgsql-general
Hello all,

I am trying to do the following query but I would like to know how
many rows were deduplicated in the process:

psql -d foo -c 'SELECT DISTINCT ON (error) error,ev_text FROM
clients_event_log' -o fullfoo


For example, I would want the output to be the following where count
is the number of error rows that were deduplicated.

count    |   error    |   ev_text
55         |  525152 |   Some text
72         |  125124 |   Some other text

I imagine it's using the count function somewhere, just not sure how
to embed that.

pgsql-general by date:

Previous
From: akp geek
Date:
Subject: Re: FSM and VM file
Next
From: Kevin Kempter
Date:
Subject: Re: How to grant a user read-only access to a database?