Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
Author |
Topic |
jbon
Starting Member
20 Posts |
Posted - 2013-09-12 : 08:27:16
|
Hi,I have a table (simplified) ctry_zone with two columns (ctry, zone)ctry_zone (ctry, zone):SE SE1 SE SE2 SE SE3 SE SE4 EE EE1 EE EE2 EE EE3 I want to create a query that returna result as below(zone_from, zone_to):SE1 EE1 SE1 EE2 SE1 EE3 SE2 EE1 SE2 EE2 SE2 EE3 ... ... SE4 EE3 Any kind of help/support/guidance is highly appreciated.Thanks in advance! |
|
sigmas
Posting Yak Master
172 Posts |
Posted - 2013-09-12 : 08:52:07
|
use self join like this:select a.zone as zone_from, b.zone as zone_tofrom ctry_zone ajoin ctry_zone bon a.ctry > b.ctry |
|
|
jbon
Starting Member
20 Posts |
Posted - 2013-09-12 : 10:33:26
|
Thanks Sigmas,your input solved my problem. |
|
|
|
|
|