creat elist of active parts with descriptions

This commit is contained in:
Paul Trowbridge 2019-03-19 10:56:11 -04:00
parent 4108c02beb
commit b6464e51b9

23
route_sql/part_list.sql Normal file
View File

@ -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