Last post Oct 12, 2015 05:04 AM by code_0087
Oct 08, 2015 05:02 AM|aspnewcoding|LINK
I have a set of SQL Stored procedure to use partitioning for my ranking to get percentile. by doing the below partitioning I am able to get my percentiles data right. However my problem is there are duplicates in each row. E.g for each DESC there are multiple
duplicates when it is suppose to be only 1 row. Why is this so?
SELECT DATE, DESC, NUM, ROW_NUMBER() OVER (PARTITION BY DATE, DESC ORDER BY NUM ASC) AS Row_Num
Oct 08, 2015 10:28 AM|limno|LINK
You need to filter out the duplicate row based on the row_num. By the name, you need to learn how to name your database objects. You table columns are using reserved word.
It will cause your trouble sooner or later.
Oct 12, 2015 05:04 AM|code_0087|LINK
Use CTE and Ranking function .