Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
От:
"K.T." <death@solaris1.mysolution.com>
Дата:
I believe its:
select DISTINCT count(*) from customerdata;
of course you are welcome to replace the "*" with a field name, but why
bother typing all those extra keystrokes :)
-----Original Message-----
From: Aaron Holtz
To: pgsql-general@postgreSQL.org
Date: Wednesday, April 28, 1999 10:44 AM
Subject: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
>This seems like a simple SQL command, but I'm getting errors.
>Running 6.5.0 under RedHat 5.2:
>
>db=> select count(distinct customer_username) from customerdata;
>ERROR: parser: parse error at or near "distinct"
>
>How do you get a count of distinct data output via postgres? I can always
>just count the number of tuples returned but this seemed to be a valid
>query.
>
>--------------------------------------------------------------------------
>Aaron Holtz
>ComNet Inc.
>UNIX Systems Specialist
>Email: aholtz@bright.net
>"It's not broken, it just lacks duct tape."
>--------------------------------------------------------------------------
>
>
>
Re: [GENERAL] Any ideas why this doesn't work or how to rewrite it?
От:
Aaron Holtz <aholtz@bright.net>
Дата:
I thought that as well, but that is counting the distinct number of rows returned from count(*) -> hence you'll always get the number of rows in your database or the number of entries in whatever field you just counted..... Thanks for the thoughts, though! -------------------------------------------------------------------------- Aaron Holtz ComNet Inc. UNIX Systems Specialist Email: aholtz@bright.net "It's not broken, it just lacks duct tape." -------------------------------------------------------------------------- On Apr 28, K.T. molded the electrons to say.... >I believe its: > select DISTINCT count(*) from customerdata; > >of course you are welcome to replace the "*" with a field name, but why >bother typing all those extra keystrokes :) > >-----Original Message----- >From: Aaron Holtz >To: pgsql-general@postgreSQL.org >Date: Wednesday, April 28, 1999 10:44 AM >Subject: [GENERAL] Any ideas why this doesn't work or how to rewrite it? > > >>This seems like a simple SQL command, but I'm getting errors. >>Running 6.5.0 under RedHat 5.2: >> >>db=> select count(distinct customer_username) from customerdata; >>ERROR: parser: parse error at or near "distinct" >> >>How do you get a count of distinct data output via postgres? I can always >>just count the number of tuples returned but this seemed to be a valid >>query. >> >>-------------------------------------------------------------------------- >>Aaron Holtz >>ComNet Inc. >>UNIX Systems Specialist >>Email: aholtz@bright.net >>"It's not broken, it just lacks duct tape." >>-------------------------------------------------------------------------- >> >> >> > > > >