Re: FW: [GENERAL] Count Distinct
I'm confused, your SELECT uses the variable "row", but there is no such variable in your table? John On Thu, 24 Aug 2000, anuj wrote: select count(distinct(row)) from table; hi, I have also tried but I am geting an error. *** tempdb= \d tbltemp Table= tbltemp +--+--+- --+ | Field | Type| Length| +--+--+- --+ | id | int4 | 4 | | name | varchar()| 40 | +--+--+- --+ tempdb= select count(distinct(row)) from tbltemp; ERROR: parser: parse error at or near "distinct" tempdb= *** Thanks Anuj -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, August 23, 2000 9:12 AM To: J. Atwood Cc: [EMAIL PROTECTED] Subject: Re: [GENERAL] Count Distinct It works fine. Please try again On Wed, 23 Aug 2000, J. Atwood wrote: 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
Re: FW: [GENERAL] Count Distinct
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"'... - Original Message - From: "John McKown" [EMAIL PROTECTED] To: "anuj" [EMAIL PROTECTED] Cc: [EMAIL PROTECTED] Sent: Thursday, August 24, 2000 4:55 AM Subject: Re: FW: [GENERAL] Count Distinct I'm confused, your SELECT uses the variable "row", but there is no such variable in your table? John On Thu, 24 Aug 2000, anuj wrote: select count(distinct(row)) from table; hi, I have also tried but I am geting an error. *** tempdb= \d tbltemp Table= tbltemp +--+--+- --+ | Field | Type| Length| +--+--+- --+ | id | int4 | 4 | | name | varchar()| 40 | +--+--+- --+ tempdb= select count(distinct(row)) from tbltemp; ERROR: parser: parse error at or near "distinct" tempdb= *** Thanks Anuj -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED]]On Behalf Of [EMAIL PROTECTED] Sent: Wednesday, August 23, 2000 9:12 AM To: J. Atwood Cc: [EMAIL PROTECTED] Subject: Re: [GENERAL] Count Distinct It works fine. Please try again On Wed, 23 Aug 2000, J. Atwood wrote: 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
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., [EMAIL PROTECTED] NSBRI Research Scientist/Programmer Computer and Information Technology Institute Rice University, 6100 S. Main St., Houston, TX 77005
Re: FW: [GENERAL] Count Distinct
Yeah, There is no column 'row'. You're trying to use 'row' as the value expression. Postgres figures it's a column reference and tries to find it (and doesn't). general set function ::= set function type left paren [set quantifier] value expression right paren Set function type is COUNT, set quantifier is DISTINCT, 'row' is not a valid value expression in this case. Note also, if I'm reading the spec right, * is not valid in this context either. On Thu, 24 Aug 2000, Ryan Williams wrote: I'm running 7.0.2 (or at least I believe so). Is there something that /I/ may be doing wrong?