What's the the SQL Server equivalent of the following MYSQL query:
SELECT id FROM products WHERE id= '$this->idLIMIT 0, 10
What's the the SQL Server equivalent of the following MYSQL query:
SELECT id FROM products WHERE id= '$this->idLIMIT 0, 10
To handle limit 10,20
*Important Use 'ORDER BY'
SELECT TOP 20 FROM products WHERE id NOT IN(SELECT TOP 10 id FROM products ORDER BY id) ORDER BY id
SELECT * FROM (
SELECT id, ROW_NUMBER() OVER (ORDER BY id) as row
FROM products where myparam='shopkeeper'
) a WHERE a.row > 0 and a.row <= 10
You can use TOP 10 in MSSQL:
SELECT TOP 10 id FROM products WITH(NOLOCK) WHERE shopkeeper = '$this->shopkeeper'
If you need from 10-20, you'll need Royi's answer.