sbraddo
2012-07-30, 06:42 PM
I would like to make a label that stacks up to 4 values for a feature. I am making the label using Topobase 2010 Admin tool. In the SQL statement below my goal is to get two values from table EL_Fuse and two values from Table EL_SWITCH when the records match my features FID to their attribute FID_Structure.
I am not trained in SQL writing but have come close with the following:
select concat_list(CURSOR(
select b.GC_DEVICEN||'\n'
||c.GC_DEVICEN||'\n'
from EL_SWITCHGEAR a, EL_FUSE b, EL_SWITCH c
where a.FID = b.FID_STRUCTURE
and b.FID_STRUCTURE = c.FID_STRUCTURE
and a.FID = $id
))myCursor from dual
This results in:
MA229\nMA227\nMA228\nMA227\nMA229\nMA226\nMA228\nMA226\n
1 rows selected.
What I want is:
MA226
MA227
MA228
MA229
MA226 and ma227 come from table EL_Switch and MA228 and MA229 Come from table EL_Fuse.
Any SQL experts out there that can correct my SQL so I get the results I want???
I am not trained in SQL writing but have come close with the following:
select concat_list(CURSOR(
select b.GC_DEVICEN||'\n'
||c.GC_DEVICEN||'\n'
from EL_SWITCHGEAR a, EL_FUSE b, EL_SWITCH c
where a.FID = b.FID_STRUCTURE
and b.FID_STRUCTURE = c.FID_STRUCTURE
and a.FID = $id
))myCursor from dual
This results in:
MA229\nMA227\nMA228\nMA227\nMA229\nMA226\nMA228\nMA226\n
1 rows selected.
What I want is:
MA226
MA227
MA228
MA229
MA226 and ma227 come from table EL_Switch and MA228 and MA229 Come from table EL_Fuse.
Any SQL experts out there that can correct my SQL so I get the results I want???