Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it? - Mailing list pgsql-general

From Aaron Holtz
Subject Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
Date
Msg-id Pine.LNX.4.05.9904282042300.8278-100000@blacker.bright.net
Whole thread Raw
In response to Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?  (Bob Dusek <bobd@palaver.net>)
List pgsql-general
Yes, I'm just taking the value ntuples returned after doing:

select distinct customer_username from customerdata group by
customer_username;


I guess my big thing was that I saw a couple of

select count(distinct something) from table;

examples in an SQL book that I have.  Was just curious as to whether psql
didn't support this type of command or decided that a better way existed
to write the query.  Thanks to all for the thoughts and ideas.  Maybe this
support will be added at some juncture.

--------------------------------------------------------------------------
Aaron Holtz
ComNet Inc.
UNIX Systems Specialist
Email:  aholtz@bright.net
"It's not broken, it just lacks duct tape."
--------------------------------------------------------------------------


On Wed, 28 Apr 1999, Bob Dusek wrote:

>Hey there...
>
>> SELECT customer_username, COUNT(customer_username) FROM customerdata GROUP BY customer_username;
>>
>
>The above query, in effect, does the same thing that:
>
>SELECT DISTINCT(customer_username) from customerdata
>
>does.  In order to get the total number of distinct customer_usernames,
>you would still have to count the rows returned (which is easily
>enough done with PHP $count = pg_NumRows($query_result)).
>
>My guess is that SELECT DISTINCT might even be a bit quicker...?? (gurus)
>
>>
>
>Bob
>


pgsql-general by date:

Previous
From: Bruce Momjian
Date:
Subject: Re: [GENERAL] UnixWare chokes
Next
From: Thomas Good
Date:
Subject: Re: [GENERAL] UnixWare chokes