Guest User

Untitled

a guest
Apr 26th, 2018
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.22 KB | None | 0 0
  1. SELECT DummyId,
  2. PartitionId,
  3. ROW_NUMBER() OVER (PARTITION BY PartitionId ORDER BY DummyId DESC) AS LastN
  4. FROM dbo.DummyTable
  5. WHERE ROW_NUMBER() OVER (PARTITION BY PartitionId ORDER BY DummyId DESC) <= 2;
Add Comment
Please, Sign In to add comment