Commit 48294168 authored by jasar.althaf's avatar jasar.althaf

Update v_ba_stage_kpi_v2.txt

parent ade62320
create or replace view v_stage_kpi as
SELECT bd.project_id,
bd.master_product_id,
bd.process_stage_id,
......@@ -89,13 +90,7 @@
round((max(f.ideal_quality))::numeric, 2) AS ideal_quality,
round((max(j.kpi_value))::numeric, 2) AS golden_batch_quality
FROM ((((batch_details bd
LEFT JOIN ( SELECT bd_1.batch_no,
bd_1.process_stage_id,
bd_1.master_product_id,
bd_1.batch_cycle_time AS golde_batch_time,
bd_1.project_id
FROM batch_details bd_1
WHERE (bd_1.golden_batch IS TRUE)) b ON ((((b.project_id)::text = (bd.project_id)::text) AND ((b.process_stage_id)::text = (bd.process_stage_id)::text) AND ((b.master_product_id)::text = (bd.master_product_id)::text))))
LEFT JOIN (select bd.batch_cycle_time as golde_batch_time ,bd.batch_no,bd.project_id ,bd.master_product_id,bd.process_stage_id from golden_batch gb left join batch_details bd on bd.batch_no =gb.batch_no and bd.project_id =gb.project_id and bd.master_product_id =gb.master_product_id and bd.process_stage_id =gb.process_stage_id ) b ON ((((b.project_id)::text = (bd.project_id)::text) AND ((b.process_stage_id)::text = (bd.process_stage_id)::text) AND ((b.master_product_id)::text = (bd.master_product_id)::text))))
LEFT JOIN ( SELECT DISTINCT bd_1.process_stage_id,
bd_1.master_product_id,
bd_1.ideal_batch_cycle_time,
......@@ -109,7 +104,7 @@
bq2.project_id
FROM batch_quality bq2
WHERE (bq2.critical_parameter IS TRUE)
GROUP BY bq2.process_stage_id, bq2.kpi_name, bq2.project_id) f ON ((((f.project_id)::text = (bd.project_id)::text) AND ((f.process_stage_id)::text = (bd.process_stage_id)::text))))
GROUP BY bq2.process_stage_id, bq2.kpi_name, bq2.project_id) f ON ((((f.project_id)::text = (bd.project_id)::text) AND ((f.process_stage_id)::text = (bd.process_stage_id)::text) AND ((f.kpi_name)::text = (bd.master_product_id)::text) )))
LEFT JOIN ( SELECT bq.batch_no,
bq.process_stage_id,
bq.kpi_name,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment