HI All, I am running a query where I am calculating a value called 'YEAR_1_TSB'. I then want to rank the values in column 'YEAR_1_TSB' where records are subsetted into groups by reg.Region and au.BICS.(where each combination of region and BICs are a unique group). I am new to all this and having real difficulty in doing this. Below is a snapshot of the code I am using with the rank() - over - partition. Can somebody help steer me in the right direction please?
,au.CompanyID AS varchar(20))
WHEN DATEDIFF (DAY,CPB.firstpricingdate,CPB.FYEDate)/365 >= 1
END AS YEAR_1_TSB
(PARTITION BY reg.REGION ORDER BY YEAR_1_TSB
desc) As xRank
Group by firstpricingdate) AS RANKONE