Reputation: 440
I am new to SQL Server 2008 R2 and got stuck in the following situation. I am trying to join two tables using inner join and addi limits and offset to the same.
Since MySQL's syntax is way different than SQL Server's, I am unable to get the result. I used this link but it didn't help me out in any way. Any help would be appreciated. Thanks!
Upvotes: 0
Views: 1394
Reputation: 151
You can use this query:
SET ROWCOUNT x -- x is Rows Count to get For Example : 50
SELECT t.*
FROM (
SELECT row_number() over (ORDER BY a.id ) AS rowindex, a.*
FROM table_1 a INNER JOIN table_2 b ON a.id = b.aid
WHERE -- limit conditions For Example : A.title = 'name2'
) AS t
WHERE t.rowindex >= y -- Y is Start index for Offset
good luck
Upvotes: 2