Re: Need help with (tricky?) select

From: Robert Garvey <robert_at_sybase.com>
Date: Tue, 26 Apr 1994 14:54:59 GMT
Message-ID: <CovG3o.4qF_at_sybase.com>


In comp.databases.sybase (<2p4e08$jqa_at_access2.digex.net>) Michael P. Stein (mstein_at_access.digex.net) wrote:
> >Here is the query you want!
> >1> select T1.city, T1.state, T2.city, T2.state
> >2> from testit T1, testit T2
> >3> where T1.city != T2.city
> >4> and T1.state != T2.state
> ^^^
> This should be OR, not AND. Think of what happens if you insert
> both Buffalo and Albany NY. The states are equal, so the AND fails;
> therefore the intrastate trip does not print out.

Also, there would be a problem computing the distance between Springfield and Springfield. Nearly every state in the USA has a town with that name.

--
  Robert.Garvey_at_sybase.com      Sybase, Inc  6475 Christie Ave
				Emeryville, CA  USA 94608-1010

Opinions may be attributed to poster, not necessarily related to Sybase.
Received on Tue Apr 26 1994 - 16:54:59 CEST

Original text of this message