Re: SQL question....
От | Karl Denninger |
---|---|
Тема | Re: SQL question.... |
Дата | |
Msg-id | 483323CE.7090200@denninger.net обсуждение исходный текст |
Ответ на | Re: SQL question.... (chester c young <chestercyoung@yahoo.com>) |
Ответы |
Re: SQL question....
|
Список | pgsql-sql |
chester c young wrote: <blockquote cite="mid:624694.72418.qm@web54303.mail.re2.yahoo.com" type="cite"><blockquote type="cite"><prewrap="">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. </pre></blockquote><pre wrap=""> 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; </pre></blockquote> Those will return single entries as well (which is easy to do with an "ORDER BY", that is computationallysimpler)<br /><br /> What I want (and can't figure out) is a SELECT that returns ONLY tuples with two or moreNAME entries that have the same IP.<br /><br /> -- Karl<br />
В списке pgsql-sql по дате отправления: