Skip to main content
Fim da Recompensa com 100 pontos de reputação concedidos por Sorack
adicionou 18 caracteres ao conteúdo
Fonte Link

Em um modo mais simples e pratico: Espero ajuda-lo

with cte as 
( 
   select usuario_id ,  
          row_number ()  over ( partition  by usuario_id order  by usuario_id )  as r
    from creditos where status = 0
        
 ) 
delete cte where r >  1 ;

Em um modo mais simples e pratico:

with cte as 
( 
   select usuario_id ,  
          row_number ()  over ( partition  by usuario_id order  by usuario_id )  as r
    from creditos where status = 0
        
 ) 
delete cte where r >  1 ;

Em um modo mais simples e pratico: Espero ajuda-lo

with cte as 
( 
   select usuario_id ,  
          row_number ()  over ( partition  by usuario_id order  by usuario_id )  as r
    from creditos where status = 0
        
 ) 
delete cte where r >  1 ;
adicionou 32 caracteres ao conteúdo
Fonte Link
user28595
user28595

Em um modo mais simples e pratico:

with cte as ( select usuario_id ,
row_number () over ( partition by usuario_id order by usuario_id ) as r from creditos where status = 0

) delete cte where r > 1 ;

with cte as 
( 
   select usuario_id ,  
          row_number ()  over ( partition  by usuario_id order  by usuario_id )  as r
    from creditos where status = 0
        
 ) 
delete cte where r >  1 ;

Em um modo mais simples e pratico:

with cte as ( select usuario_id ,
row_number () over ( partition by usuario_id order by usuario_id ) as r from creditos where status = 0

) delete cte where r > 1 ;

Em um modo mais simples e pratico:

with cte as 
( 
   select usuario_id ,  
          row_number ()  over ( partition  by usuario_id order  by usuario_id )  as r
    from creditos where status = 0
        
 ) 
delete cte where r >  1 ;
Fonte Link

Em um modo mais simples e pratico:

with cte as ( select usuario_id ,
row_number () over ( partition by usuario_id order by usuario_id ) as r from creditos where status = 0

) delete cte where r > 1 ;