Count & Distinct

Started by J. Atwoodover 25 years ago4 messagesgeneral
Jump to latest
#1J. Atwood
jatwood@bwanazulia.com

Search a lot of archives and have come up with very little (much old)

obviously

select count(distinct(row)) from table;

Does not work so what is the work around? I have tried a bunch of stuff.

Thanks,
J

#2Mitch Vincent
mitch@venux.net
In reply to: J. Atwood (#1)
Re: Count & Distinct

hhs=# select count(distinct(fieldorder)) from temp_fields;
count
-------
3

I just tried it really quick and it worked fine.. What are you getting with
what table/view and query?

-Mitch

----- Original Message -----
From: "J. Atwood" <jatwood@bwanazulia.com>
To: <pgsql-general@postgresql.org>
Sent: Wednesday, August 23, 2000 3:45 PM
Subject: [GENERAL] Count & Distinct

Show quoted text

Search a lot of archives and have come up with very little (much old)

obviously

select count(distinct(row)) from table;

Does not work so what is the work around? I have tried a bunch of stuff.

Thanks,
J

#3Tom Lane
tgl@sss.pgh.pa.us
In reply to: J. Atwood (#1)
Re: Count & Distinct

"J. Atwood" <jatwood@bwanazulia.com> writes:

select count(distinct(row)) from table;

Does not work so what is the work around? I have tried a bunch of stuff.

I bet you didn't try updating to 7.0?

regards, tom lane

#4J. Atwood
jatwood@bwanazulia.com
In reply to: Tom Lane (#3)
Re: Count & Distinct

Yup.. I (original poster) am using 6.5.3 and should/would/will head to 7.0.2
(already on another site in production). Just waiting for the time/need.

Thanks to everyone for their help.

J

Show quoted text

From: "Ryan Williams" <shrewsbury@louisiana.com>
Date: Thu, 24 Aug 2000 12:08:46 -0700
To: <pgsql-general@postgresql.org>
Subject: Re: FW: [GENERAL] Count & Distinct

I'm running 7.0.2 (or at least I believe so). Is there something that /I/
may be doing wrong?

----- Original Message -----
From: "Ross J. Reedstrom" <reedstrm@rice.edu>
To: <pgsql-general@postgresql.org>
Sent: Thursday, August 24, 2000 8:44 AM
Subject: Re: FW: [GENERAL] Count & Distinct

On Thu, Aug 24, 2000 at 10:35:49AM -0700, Ryan Williams wrote:

I find that if I create the table described in the email, in psql I

recieve

'ERROR: Attribute 'row' not found'...

But this isn't exactly 'ERROR: parser: parse error at or near
"distinct"'...

Right, that's the error you get from doing this in 6.5.x. The original
poster has already been advised to upgrade to 7.0.2.

Ross

--
Ross J. Reedstrom, Ph.D., <reedstrm@rice.edu>
NSBRI Research Scientist/Programmer
Computer and Information Technology Institute
Rice University, 6100 S. Main St., Houston, TX 77005