Re: count( distinct x )

From: Anthony <lists(at)a1(dot)org(dot)uk>
To: pgsql-sql(at)postgresql(dot)org
Subject: Re: count( distinct x )
Date: 2000-11-27 18:24:45
Message-ID: 3A22A6ED.8A9D89B2@a1.org.uk
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Jose Rodrigo Fernandez Menegazzo wrote:

> > The problem I have is with this statement:
> >
> > select count( distinct area ) from areapostcode where postcode like
> > 'BS1%'
> >
> > the above statement fails with
> > ERROR: parser: parse error at or near "distinct"
> >
> > I am not the greatest when it comes to SQL, but the pgsql docs implied
> > that the above would work.
> >
> > What I am trying to do is get a count of the no of matches from the
> > statement below
> > select distinct area from areapostcode where postcode like 'BS1%'
> >
> > Not the count of:
> > select area from areapostcode where postcode like 'BS1%'
> >
>
> I don't have where to try it, but have you tried:
>
> select distinct count(area) from areapostcode where postcode like 'BS1%'
>
> Rodrigo F.

yes, it responds as if distinct is not in the query string.

Thanks,
Bap.

In response to

Browse pgsql-sql by date

  From Date Subject
Next Message Michael Fork 2000-11-27 18:47:37 Re: count( distinct x )
Previous Message Jose Rodrigo Fernandez Menegazzo 2000-11-27 18:08:06 Re: count( distinct x )