SELECT DISTINCT p.id,p.[markaID],p.[retail_store_price],p.[Categories] FROM [products] AS p WHERE (CHARINDEX(',1016,', p.categories)>0 OR p.categories='1016') | Timer 0: 0 ms | Timer 1: 20 ms | Timer 2: 2 ms | pagerTotal=4 | filtering=False | Timer 3: 19 ms | catID=1016 | kz.count=0 | title DESC | title | Timer 4: 0 ms | SELECT DISTINCT [id] FROM (SELECT Row_Number() OVER ( ORDER BY p.title DESC) AS RowIndex, p.id FROM [products] AS p WHERE p.id IN(16306,16307,16308,16325)) AS Sub WHERE Sub.RowIndex >= 1 AND Sub.RowIndex <= 12;