Need help with (tricky?) select

From: John Bartley <john_at_wpa.com>
Date: Tue, 19 Apr 1994 06:29:38 GMT
Message-ID: <CoHu1F.5tv_at_nimno.wpa.com>


I think I've found the limit of my SQL-writing capabilities while trying to come up with a solution to this problem:

I have a list of about 300 city names. I need to create a list of city pairs for input into a PC program that computes the highway miles between two cities. The output from this process will be fed back into a logistics package for use in scheduling truck deliveries. Suppose there were only three cities in the city table - Akron, Buffalo, Chicago. I'm trying to build the following output (there's a twist here, in that Akron to Buffalo is not considered the same as Buffalo to Akron.)

FCITY		FST	TCITY		TST
==============	===	=============	===
Akron		OH	Buffalo		NY
Akron		OH	Chicago		IL
Buffalo		NY	Akron		OH
Buffalo		NY	Chicago		IL
Chicago		IL	Akron		OH
Chicago		IL	Buffalo		NY

(The "seed" table contains only the 'fcity' and 'fst' columns - I need to
create the pairs as shown.)

I'm hoping that this is trivially simple for someone who writes this stuff every day. It has been (apparently) too many years since I took Oracle training classes, and I'm having trouble conceptualizing how to approach this. Can anyone take pity on me and give me a few clues? :-)

Thanks a lot for any help!

John Bartley
john_at_wpa.com

(please reply by e-mail if possible - my news feed is way behind.)
Received on Tue Apr 19 1994 - 08:29:38 CEST

Original text of this message