Re: [HACKERS] Should the following work...?

Поиск
Список
Период
Сортировка
От Clark Evans
Тема Re: [HACKERS] Should the following work...?
Дата
Msg-id 37011B93.22617BEB@manhattanproject.com
обсуждение исходный текст
Ответ на Should the following work...?  (The Hermit Hacker <scrappy@hub.org>)
Список pgsql-hackers
The Hermit Hacker wrote:
>
> select id
>   from clients
>  where id = ( select id
>                 from clients
>                where count(id) = 1 ) ;
>

Hmm.  If you are trying to identify 
duplicate id's then try :

select distinct id from client x
where 1 <  ( select count(id)      from client y    where y.id = x.id );


Ideally, this would be done as:

select a from   ( select a, count(a) cnt       from test   group by a ) where cnt < 2;

However, PostgreSQL dosn't support
dynamic views.  This, btw, is a 
very useful feature.

Hope this helps,

Clark


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

Предыдущее
От: The Hermit Hacker
Дата:
Сообщение: RE: [HACKERS] Should the following work...?
Следующее
От: Clark Evans
Дата:
Сообщение: Re: [HACKERS] Should the following work...?