Re: SELECT DISTINCT and count(1) - Mailing list pgsql-novice

From nobs@nobswolf.info (Emil Obermayr)
Subject Re: SELECT DISTINCT and count(1)
Date
Msg-id 20090716104212.GT30035@nobswolf.info
Whole thread Raw
In response to SELECT DISTINCT and count(1)  (A B <gentosaker@gmail.com>)
List pgsql-novice
On Thu, Jul 16, 2009 at 11:57:56AM +0200, A B wrote:
>
> select distinct userid  from  usertable,<more tables>  where <conditions>;
>
> and then count the rows in the result

make it a subselect and count in the outer select:

select count(*) as num from (select distinct...) dummy;

pgsql-novice by date:

Previous
From: A B
Date:
Subject: Re: SELECT DISTINCT and count(1)
Next
From: A B
Date:
Subject: need some more select help