dimanche 28 juin 2015

Rank in Where Clause

Is it possible to use Rank in a Where Clause. Below is the code that I am intending to use

  Select 
   DebtorID
  ,Rank () over (partition by DebtorID order by BalanceDate) as RankBalanceDate
  ,BalanceDate
  ,Balance
  ,UnallocatedBalance
  ,Overdue
From Debtorbalances
Where Rank () Over (Partition by DebtorID order by BalanceDate) = 1

Aucun commentaire:

Enregistrer un commentaire