sql - Group data by team -


I have made the case that when work shows that pass from one team to another I work orders that again : Were able to and should be able to run a query from and to show the teams from the audit a_workorder table.

  Status persongroup wonum eaudittimestamp 1. reassign TEAM4 324,153 30 / 07/2014 22:15 2. reassign carp 324,153 07/30/2014 22:15 3. reassign TEAM1 324 145 07/30/2014 22:34 4. reassign FOODBEV 324,145 30/07/2014 22:34  

is run for all wonum with the query, persongroup carp Incorporating the work order number 324,153 of TEAM4 carp as line 1 and 2 should be reassigned.

This is an irregular solution (it always prevents me when I choose different uses am), but the most you need a foundation to:

  as of the (selected with the ranks Prsogrup, victorious, Idaitimstamp, Min (Idaitimstamp) over (win Split from) as the minimum _time, max (eaudittimestamp) (split by wonum) from a_workorder to max_time), as wos (choose a different wonum than a_workorder) Select wos.wonum, first_group as r1.persongroup, last_group as joining more than R2kpersongroup Wos ranks R1 .wonum on Wos = Rlkwonum and ranks join r1.eaudittimestamp = r1.min_time wos.wonum = r2.wonum and r2.eaudittimestamp = R2   

the results of your sample data:

  to win the first group's Groups - ----------- ---------- 324153 'TEAM4' 'CARP' 324145 'TEAM1' 'FOODBEV'  
< / Html>

Comments

Popular posts from this blog

sqlite3 - UPDATE a table from the SELECT of another one -

c# - Showing a SelectedItem's Property -

javascript - Render HTML after each iteration in loop -