From 82b0b10dfb88aef527f2b1d7d3b29584e414cc9c Mon Sep 17 00:00:00 2001 From: Trowbridge Date: Tue, 16 Apr 2019 18:48:56 -0400 Subject: [PATCH] query no cost --- route_sql/build/test_cost.sql | 40 +++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100644 route_sql/build/test_cost.sql diff --git a/route_sql/build/test_cost.sql b/route_sql/build/test_cost.sql new file mode 100644 index 0000000..158ee7e --- /dev/null +++ b/route_sql/build/test_cost.sql @@ -0,0 +1,40 @@ +WITH nc AS ( +select + part + ,plnt + , to_char(sum(fb_val_loc * r_rate),'9,999,999') sales + , to_char(sum(fb_qty),'9,999,999') units +from + rlarp.osm_fcpool +where + ( + + ( + fb_qty <> 0 + and coalesce(fb_cst_loc,0) = 0 + ) + or plnt is null + ) + and version = 'b20' +group by + part + ,plnt +) +SELECT + nc.* + ,v6stat + ,coalesce(cgstcs, chstcs,y0stcs) stcs +FROM + nc + left outer join lgdat.stka ON + v6part = part + and v6plnt = plnt + left outer join lgdat.icstm ON + cgpart = part + and cgplnt = plnt + left outer join lgdat.icstp ON + chpart = part + and chplnt = plnt + left outer join lgdat.icstr ON + y0part = part + and y0plnt = plnt