Note that there are some explanatory texts on larger screens.

plurals
  1. POI need to combine 2 queries into one on query 1 area to query 2 description and query 1 empl to query 2 employee_id
    primarykey
    data
    text
    <p>I have the following 2 queries and their output.</p> <p>Query 1</p> <pre><code>select types,area,avg(time2)as time,empl,whse,des from(select l.control_number_2 as types, l.control_number as area, sum(round(cast(DATEDIFF(ss, l.start_tran_time,l.end_tran_time) /60.0 as float),2))over (partition by l.control_number) time2, l.employee_id as empl, l.wh_id as whse , (select distinct lu.description from t_lookup lu where lu.description = l.control_number) as des from t_cp_work_area_log l where start_tran_date &gt;= '2010-05-04 00:00:00.000' ) t group by whse, empl,types, area,des </code></pre> <p>Query 2</p> <pre><code>select t.client_code,t.tran_type, t.employee_id,count(t.hu_id)as plts, lu.description,cs.prod_id, ps.fixed_std, ps.dynamic_std,(fixed_std/sum(fixed_std) OVER (PARTITION BY lu.description)) "fs_summed",fixed_std/60 as stand_per_min from t_tran_log t, t_lookup lu, t_cp_client_prod_stds cs, t_cp_prod_stds ps where lu.text = t.tran_type and lu.source in ('t_cp_prod_stds','t_cp_work_area') and t.client_code = cs.client_code and cs.prod_id = ps.prod_id and ps.work_type = lu.text and t.start_tran_date &gt;= '2010-05-04 00:00:00.000' group by t.tran_type, t.client_code,t.employee_id, cs.prod_id,lu.description,ps.fixed_std, ps.dynamic_std </code></pre> <p>Output query 1</p> <pre><code>types area time empl whse des Inventory ADJ 7 TA C1 ADJ LOG-ON LOG-ON 55.4 TA C1 LOG-ON Outbound LDG 62.7 TA C1 NULL Outbound PCKG 11.45 TA C1 NULL Receiving RCVG 8.73 TA C1 RCVG </code></pre> <p>Output query 2</p> <pre><code>client_code tran_type emplyee_id plts description prod_id fixed_std dynamic_std fs_summed stand_per_min 826 853 TA 2 ADJ 13 50 50 1 0.833333 810 114 TA 1 RCVG 4 50 50 0.555555556 0.833333 826 114 TA 1 RCVG 11 40 40 0.444444444 0.666666 </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload