I have a scenario where i have a message table, which is like this
MessageId int primary key
There is a tendency for messages to be duplicated, but the hash will be unique for such messages.
Now I page the table based on some sorting, and using standard sql server paging query.
select * from (select ROW_NUMBER() over (order by name ASC) as RI, * from MessageTable where token = '1') as SUB WHERE SUB.RI >= 50 AND SUB.RI <= 100
What I want to do now is that I want to choose unqiue hash messagetable rows and then do the above operation on it.
GROUP BY Hash
I can't seem to get this using subquery, can somebody suggest a way for that?