Le circuit a deux extrémités (jambes) et chaque jambe est connectée à l'appareil. SO résultat est symétrique à un circuit de chaque côté dire et B. Je cherche à trier mes résultats SQL comme ci-dessous:oracle ordre par: résultats de la commande symétriquement
component location pathelement
-------------------------------
device_A A A_DD1
device_A A A_DD2
device_A A A_DD3
leg_A L_A A_LL1
leg_A L_A A_LL2
circuit Center CCCC
leg_B L_B B_LL1
leg_B L_B B_LL2
device_B B B_DD2
device_B B B_DD3
. ma requête est:
sortie réelleselect component,location,pathelement,sortorder from
(select c.name circuit,l.name leg,d.name d,
c.location c_loc,l_pe.location l_loc,d_pe.location d_loc,
c_pe.pathelements c_pe,l_pe.pathelements l_pe,d_pe.pathelements d_pe,
1 d_sortorder,2 l_sortorder,3 c_sortorder
from circuit c,leg l,device d,
(select circuitid,location,pathelements from circuit_details) c_pe,
(select legid,location,pathelements from leg_details)l_pe,
(select deviceid,location,pathelements from device_details)d_pe
where
c.circuit2leg=l.legid(+)
and l.leg2device=d.deviceid(+)
and c.circuitid=c_pe.circuitid(+)
and l.legid=l_pe.legid(+)
and d.deviceid=d_pe.deviceid(+)
and c.name=<some_text>)
Unpivot((component,location,pathelement,sortorder) for c in
((circuit,c_loc,c_pe,c_sortorder),(leg.l_loc,l_pe,l_sortorder),(device,d_loc,d_pe,d_sortorder))) order by sortorder;
était:
component location pathelement
-------------------------------
device_A A A_DD1
device_A A A_DD2
device_A A A_DD3
device_B B B_DD2
device_B B B_DD3
leg_A L_A A_LL1
leg_A L_A A_LL2
leg_B L_B B_LL1
leg_B L_B B_LL2
circuit Center CCCC
Vous sélectionnez 4 colonnes, mais seulement nous montrent trois d'entre eux. Celui que vous avez commandé est manquant ... – jarlh
Quel est le résultat attendu si vous ajoutez des éléments C? – jarlh
Vous ne manquez pas un leg_A dans votre exemple? –