sql - Remove sequential dupelicates -


I have an event management system that enters rows in a DB by updating a record every time

A work may start - & gt; Edit - & gt; Approve - & gt; Decline - & gt; Edit - approval->

However, it can be updated some time by somebody, so there are several entries for a position such as

Start - & gt; Edit - & gt; Edit - & gt; Edit - & gt; Approve - & gt; Decline - & gt; Decline - & gt; Edit - approval->

I would like to remove squalidity duplicates, but if this situation is later, then

I

  SELECT taskid, version, taskstats, ROW_NUMBER ()   

Which product is

  in sqtaskflow in sideways    > Id var status rank 16 1 qa full 1 16 2 qa full 2 ​​16 3 qa full 3 16 4 in line 16 5 in queue 2 16 6 in queue 3 16 7 q Full 4 16 8 QA Full 5 16 9 QA Full 6 16 10 Functions Completed 1   

The desired output will be

  id var status position 16 1 QA full 1 16 4 queue 1 16 7 QA Full 4 16 10 work complete 1    

Assume that version is always sequential, no interval ...

  SELECT taskid, repeats MIN (version) first_version, taskstatus, COUNT (*) (SELECT taskid, CAST (version AS INT) AS version, TaskSthis, ROW_NUMBER () o RA (tasked by tasked, order by function, cast (version as integer)) AS Task_Ordinal, ROW_NUMBER () Over (tasked by division, taskasat order or tasked, cast (version as int)) from workstation_status_ordinal to eskatsacflo ) AS Indexed Group By Tasked, TaskStatus, Task_Ordinal - Task_Status_Ordinal ORDER By Tasked, TaskStatus, Min (Version)   


Example D Id

  ID Vir Status Status Rank Rank 161 QA Full 1 0 16, QA Full, 0 16 2 QA Full 2 ​​0 16, QA Full, 0 16 3 QA Full 3 0 16, QA Full, 0 16 4 in line 1 3 16, in line, 3 16 5 queue 2 3 16, in line, 3 16 6 line 3 3 16, in line, 3 16 7 QA Full 4 3 16, QA Full, 3 16 8 QA Full 5 3 16, QA Full, 3 16 9 QA Full 6 3 16, QA Full, 3 16 10 Work Complete 1916, Work Completed, 9   

Edit:

Comments

Popular posts from this blog

Java - Error: no suitable method found for add(int, java.lang.String) -

java - JPA TypedQuery: Parameter value element did not match expected type -

c++ - static template member variable has internal linkage but is not defined -