title: Including VersionNumber with record
body: <p>I currently have a version number column in my table and all of them are set to one. However, sometimes accounts get closed or reopened and sometimes they may even get updated. I would like to assign a version Number for each new version of the account, which is made possible through the AccountCreatedDate. So anytime the account is created or updated it provides us with an AccountCreatedDate. So the oldest AccountCreatedDate should get a version number 1, the next should get number 2 and so on. How can this be done please provide code on how to accomplish this. I have provided code that groups the same accounts together as the same  account will have the same TimeID and I have them in ascending order. How can I give them version numbers? Each record does have its own identity value known as InputRowID</p>
  
  <pre><code>    Select * from ods.SchedulePayment
      where TimeID IN(
         Select TimeID
         FROM ods.SchedulePayment
         GROUP BY TimeID
         HAVING COUNT(*) &gt;1
     )ORDER BY TimeID, AccountCreatedDate
  </code></pre>