sql server - how can i group them in two different groups use only single column -
how can group them in 2 different groups use single column
sample data:
date_entry time_start time_finished idle_code qty_good 8/8/2013 13:00 13:30 6 10 8/8/2013 13:30 15:20 0 20 8/8/2013 15:20 15:30 6 5 8/8/2013 15:30 16:25 0 10 8/8/2013 16:25 16:40 7 0 8/8/2013 16:40 17:25 0 40 8/8/2013 17:25 17:40 3 10 8/8/2013 17:40 24:00 1 8/8/2013 24:00 00:00 1 8/8/2013 00:00 00:30 1
result
idle_code total mins. idle time #1 410:00 mins idle time #2 0:00 mins idle time #3 15:00 mins idle time #4 0:00 mins idle time #5 0:00 mins idle time #7 15:00 mins idle time #0,6 250:00 mins (a) total idle time 440:00mins(idle time #0,6 not include) (b) total operation time 250:00mins(idle time #0,6 only)
how can total sum of idle_code 1 or how can group them sum??
sample sql
select dbo.t_monitoring_pi_oper_entry.wo_number, dbo.t_monitoring_pi_oper_entry.qty_rejected, dbo.t_monitoring_pi_oper_entry.operator, dbo.t_monitoring_pi_oper_entry.reject_code, dbo.t_monitoring_pi_oper_entry.qty_good, dbo.t_monitoring_pi_oper_entry.idle_code, dbo.t_monitoring_pi_oper_entry.time_finished, dbo.t_monitoring_pi_oper_entry.time_start, dbo.t_monitoring_pi_oper_entry.date_entry dbo.t_monitoring_pi_oper_entry
select sum(dbo.t_monitoring_pi_oper_entry.time_finished,1,0) dbo.t_monitoring_pi_oper_entry group idle_code
Comments
Post a Comment