i want to select top 3 values from a table where a particular column should have distinct values only..
how to write the stored procedure in such case??
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Rafnas T PPosted Feb 7, 2017, 2:14 AM
ROW_NUMBER() OVER (PARTITION BY [column name having duplicate values] ORDER BY id) AS RowNumber
FROM tableName
) AS a
WHERE a.RowNumber = 1