diff --git a/route_sql/part_list.sql b/route_sql/part_list.sql new file mode 100644 index 0000000..d0ce852 --- /dev/null +++ b/route_sql/part_list.sql @@ -0,0 +1,23 @@ +WITH +act As ( + SELECT DISTINCT + v6part part + FROM + lgdat.stka + WHERE + v6stat = 'A' +) +,stkm AS ( + SELECT + act.part || ' - ' ||rtrim(COALESCE(m.avdes1,p.awdes1)) part + --,COALESCE(m.avgled, p.awgled) glec + FROM + act + LEFT OUTER JOIN lgdat.stkmm m ON + m.avpart = act.part + LEFT OUTER JOIN lgdat.stkmp p ON + p.awpart = act.part + WHERE + substr(COALESCE(m.avgled, p.awgled),1,1) <= '2' +) +select part from stkm \ No newline at end of file