title: Generate Row Serial Numbers in SQL Query
body: <p>I have a customer transaction table. I need to create a query that includes a  serial number pseudo column. The serial number should be automatically reset and start over from 1 upon change in customer ID.</p>
  
  <p>Now, I am familiar with the row_number() function in SQL. This doesnt exactly solve my problem because to the best of my knowledge the serial number will not be reset in case the order of the rows change.</p>
  
  <p>I want to do this in a single query (SQL Server) and without having to go through any temporary table usage etc.</p>
  
  <p>Any ideas?</p>
  
  <p>Thanks in advance</p>