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

From Bob Dusek
Subject Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
Date
Msg-id Pine.LNX.3.96.990428182523.468A-100000@toots.palaver.net
Whole thread Raw
In response to Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?  ("Gene Selkov, Jr." <selkovjr@mcs.anl.gov>)
Responses Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?  (Aaron Holtz <aholtz@bright.net>)
List pgsql-general
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: valter
Date:
Subject: Re: [GENERAL] Search engine with PostgreSQL
Next
From: Thomas Good
Date:
Subject: Re: [GENERAL] UnixWare chokes