From: Jose Rodrigo Fernandez Menegazzo <rocket@datascan-site.com>
To: lists@a1.org.uk
Cc: pgsql-sql@postgresql.org
Subject: Re: count( distinct x )
Date: Mon, 27 Nov 2000 12:08:06 -0600 (CST)
Message-ID: <1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com> (raw)
In-Reply-To: <3A229EBB.F55BA11@a1.org.uk>
References: <3A229EBB.F55BA11@a1.org.uk>
> 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.
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients from your mail client; the link fills in
the headers below: reply via email
Some clients, webmail especially, drop In-Reply-To and References from
a link, and the reply then starts a new thread: use the mbox below.
To: pgsql-sql@postgresql.org
Cc: rocket@datascan-site.com, lists@a1.org.uk
Subject: Re: count( distinct x )
In-Reply-To: <1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com>
References: <3A229EBB.F55BA11@a1.org.uk> <1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox