SELECT DISTINCT p.id,p.[markaID],p.[retail_store_price],p.[Categories] FROM [products] AS p WHERE (CHARINDEX(',1018,', p.categories)>0 OR p.categories='1018') | Timer 0: 1 ms | Timer 1: 19 ms | Timer 2: 2 ms | pagerTotal=5 | filtering=False | Timer 3: 644 ms | catID=1018 | kz.count=0 | title DESC | title | Timer 4: 1 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(16386,16692,16716,16717,16807)) AS Sub WHERE Sub.RowIndex >= 1 AND Sub.RowIndex <= 12;