Re: count( distinct x )

Поиск
Список
Период
Сортировка
От Jose Rodrigo Fernandez Menegazzo
Тема Re: count( distinct x )
Дата
Msg-id 1092.192.168.0.9.975348486.squirrel@mail.datascan-site.com
обсуждение исходный текст
Ответ на count( distinct x )  (Anthony <lists@a1.org.uk>)
Список 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.




В списке pgsql-sql по дате отправления:

Предыдущее
От: Anthony
Дата:
Сообщение: count( distinct x )
Следующее
От: Anthony
Дата:
Сообщение: Re: count( distinct x )