Hi, i was wondering whether some SQL expert would be willing to take a look at this query for me. It is a search query that is frequently used on our site so it needs to perform great. The query handles PAGING on the website, so everytime i need to get the total count of rows based on the search parameters, and then i have to select the rows in the current PageIndex (based on specified pageSize). To get the total rows in the first query select them into a variable, like this: @totalPropertiesCount = COUNT(id) First of, i have a problem with getting the total COUNT of rows when using the following (in query number 2): SELECT TOP 200 ROW_NUMBER() OVER (ORDER BY id ASC) AS row... So for the time being i need select the content TWICE, once to get the total count, and then again to get rows based on the current pageIndex (so obviously the query needs some tuning). Let me know if you want me to paste the whole query into the thread. Thanks and regards, Bjorn.