独特的组合,没有重复的个人价值

时间:2019-05-28 05:44:11

标签: mysql sql

我已根据某些条件对行进行了排名。让我们将排名列称为

time_rank和id_rank。

Window_id  time_rank  id_rank    
   1          1         1    
   1          2         1   --> 1 is already considered, reject this row    
   2          1         1    
   2          1         2   --> 1 is already considered, reject this row 
   2          2         2       
   3          1         1     
   3          2         1   --> 1 is already considered, reject this row
   3          1         2   
   3          3         2
   4          1         1
   4          2         1   --> 1 is already considered, reject this row 
   4          2         2
   4          3         1   --> 1 is already considered, reject this row 

尝试了一些技巧,包括lag,另一个排名和自我加入。似乎没有任何工作。我需要找到无重复的独特组合:

所需的输出:

Window_id  time_rank  id_rank
   1          1         1  
   2          1         1
   2          2         2
   3          1         1 
   3          3         2
   4          1         1
   4          2         2

0 个答案:

没有答案