pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
From: Frank Bax <fbax@sympatico.ca>
To: pgsql-sql@postgresql.org
Subject: Re: select count of distinct rows
Date: Sat, 10 Dec 2005 20:23:14 -0500
Message-ID: <5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca> (raw)
In-Reply-To: <003001c5fded$53a2c5a0$0200a8c0@OTTO>
References: <20051209053849.498E8F0BEC@svr2.postgresql.org>

At 07:53 PM 12/10/05, Havasvölgyi Ottó wrote:
>I would like to select the count of distinct rows in a table.
>         SELECT COUNT(DISTINCT *) FROM mytable;
>This does not work. How can I do it with Postgres?


select count(*) from (select distinct * from mytable) as x;




view thread (11+ messages)  latest in thread

Message-ID: <5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca>
Permalink:  ../5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca/
Also on:    postgresql.org/message-id/5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca

 · 

reply

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Reply to all the recipients using the --to and --cc options:
  reply via email

  To: pgsql-sql@postgresql.org
  Cc: fbax@sympatico.ca
  Subject: Re: select count of distinct rows
  In-Reply-To: <5.2.1.1.0.20051210202158.0344ac80@pop6.sympatico.ca>

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox