| From: | Jose Rodrigo Fernandez Menegazzo <rocket(at)datascan-site(dot)com> |
|---|---|
| To: | lists(at)a1(dot)org(dot)uk |
| Cc: | pgsql-sql(at)postgresql(dot)org |
| Subject: | Re: count( distinct x ) |
| Date: | 2000-11-27 18:08:06 |
| Message-ID: | 1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com |
| Views: | Whole Thread | Raw Message | Download mbox | Resend email |
| Thread: | |
| Lists: | pgsql-sql |
> 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.
| From | Date | Subject | |
|---|---|---|---|
| Next Message | Anthony | 2000-11-27 18:24:45 | Re: count( distinct x ) |
| Previous Message | Yoghini Thevarajah | 2000-11-27 18:06:19 | FW: Sharing Databases |