Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?

From: Aaron Holtz <aholtz(at)bright(dot)net>
To: Bob Dusek <bobd(at)palaver(dot)net>
Cc: "Gene Selkov, Jr(dot)" <selkovjr(at)mcs(dot)anl(dot)gov>, pgsql-general(at)postgreSQL(dot)org
Subject: Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
Date: 1999-04-29 00:45:26
Message-ID: Pine.LNX.4.05.9904282042300.8278-100000@blacker.bright.net
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: 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(at)bright(dot)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
>

In response to

Browse pgsql-general by date

  From Date Subject
Next Message Martin Wong 1999-04-29 02:07:20 LIMIT QUESTION
Previous Message Bruce Momjian 1999-04-29 00:21:37 Re: [GENERAL] UnixWare chokes