Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

SQL Server:SELEZIONA solo le righe con MAX(DATE)

Se rownumber() over(...) è a tua disposizione....

select OrderNO,
       PartCode,
       Quantity
from (select OrderNO,
             PartCode,
             Quantity,
             row_number() over(partition by OrderNO order by DateEntered desc) as rn
      from YourTable) as T
where rn = 1