SELECT DISTINCT p.id,p.[markaID],p.[retail_store_price],p.[Categories] FROM [products] AS p WHERE (CHARINDEX(',312,', p.categories)>0 OR p.categories='312') | Timer 0: 0 ms | Timer 1: 25 ms | Timer 2: 8 ms | pagerTotal=9 | filtering=False | Timer 3: 2705 ms | catID=312 | kz.count=0 | title DESC | title | Timer 4: 3 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(3202,12793,12795,12796,14921,14922,16217,16262,16511)) AS Sub WHERE Sub.RowIndex >= 1 AND Sub.RowIndex <= 12;