Re: SQL question....

Поиск
Список
Период
Сортировка
От chester c young
Тема Re: SQL question....
Дата
Msg-id 624694.72418.qm@web54303.mail.re2.yahoo.com
обсуждение исходный текст
Ответ на SQL question....  (Karl Denninger <karl@denninger.net>)
Ответы Re: SQL question....  (Karl Denninger <karl@denninger.net>)
Список pgsql-sql
> create table access (name text, address ip)
> 
> I want to construct a SELECT statement which will return ONLY tuples 
> containing IP and name pairs IF there is an IP that has two or more 
> NAMEs associated with it.
> 
>

many ways:

select a1.* from access a1 where exists(   select 1 from access a2 where a2.name=a2.name and a1.ip!=a2.ip );

select a1.*
from    access a1
join    access a2 using( name )
where   a1.ip != a2.ip;



     


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

Предыдущее
От: Karl Denninger
Дата:
Сообщение: SQL question....
Следующее
От: Karl Denninger
Дата:
Сообщение: Re: SQL question....