This is my query:
SELECT Top 30 *
FROM (SELECT *, Row_number() OVER( PARTITION BY EntityPicURL
ORDER BY FavoriteCount desc) AS RN
FROM TweetEntity
WHERE HashTag LIKE '%%23RIPOlgaSyahputra%') A
WHERE RN = 1
ORDER BY FavoriteCount desc , LastModifieddateTime desc
This will select the first 30 unique records of the column entitypicURl
. Now that I want to select the next 30 records (31-60).
This is a sort of a query i used earlier but this returned many duplicate entries of entitypicURL
.
select *
from (select *, row_no = row_number() over (order by FavoriteCount desc,
LastModifiedDateTime desc)
from TweetEntity
where HashTag like '%%23RIPOlgaSyahputra%') e
where e.row_no > 30 and e.row_no <=60
Now i want to combine the value of first query and include e.row_no>30 and e.row_no<60
from the second query.
It is not a duplicate. My confusion is just combining two queries because both has got row_numbers.