I am a novice SQL user.
I have two tables. On has overview information about linear features, e.g. feature type, name, etc., table_1. Each linear feature exists in three spatial zones. The second table has the x,y locations for each linear feature as it crosses from zone to zone, table_2. The x,y is in two columns and the zone crossed into is in a 3rd. The only column that I have to tie the tables to each other is the name. What I would like to do is join the x,y information to table_1 three times. The only column that I have to Once for each zone.
TABLE_1
NAME TYPE
LINE_1 A
LINE_2 B
TABLE_2
NAME ZONE X Y
LINE_1 ZONE_1 53.36 48.99
LINE_2 ZONE_1 4.36 81.38
LINE_1 ZONE_2 41.11 93.85
LINE_2 ZONE_2 92.86 5.37
LINE_1 ZONE_3 3.44 87.41
LINE_2 ZONE_3 24.45 78.60
TABLE_OUT
NAME TYPE X_ZONE_1 Y_ZONE_1 X_ZONE_2 Y_ZONE_2 X_ZONE_3 Y_ZONE_3
LINE_1 A 53.36 48.99 41.11 93.85 3.44 87.41
LINE_2 B 4.36 81.38 92.86 5.37 24.45 78.60
I can do one zone ok...
SELECT A.NAME, B.X AS X_ZONE_1, B.Y AS Y_ZONE_2 FROM
TABLE_1 A, TABLE_2 B
WHERE A.NAME = B.NAME
AND B.ZONE = '1'