Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
От | Aaron Holtz |
---|---|
Тема | Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it? |
Дата | |
Msg-id | Pine.LNX.4.05.9904282042300.8278-100000@blacker.bright.net обсуждение исходный текст |
Ответ на | Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it? (Bob Dusek <bobd@palaver.net>) |
Список | 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 по дате отправления: