Okay - I have been playing with Row Number in SQL for a while and can't seem to get results I desire.
I have this query:
select
Type,
TypeID,
InvoiceDate,
LeadDate,
Account,
CustomerID,
ProviderID,
LeadID,
Name,
Fee,
ROW_NUMBER() OVER (
PARTITION BY [Account],[CustomerID], [InvoiceDate],[TYPE],[TypeID]
ORDER BY [Account],[CustomerID] DESC
) AS [ROWNUMBER]
from APFM_SOP_STAGING2
It returns this:
What I need is the first 13 records (1764/44527) combination to be Row Number = '1' then the last two records (1899/44528) combination to be Row number='2'
Basically I am trying to use row number partition to 'group' data - which I don't think it was designed to do.....
Any assistance or guidance would be appreciated. Thank you in advance.