公告
财富商城
积分规则
提问
发文
2019-01-01 11:12发布
牵手、夕阳
I have this query with mysql :
select * from table1 LIMIT 10,20
How can I do this with Microsoft sql ?
SELECT TOP 10 * FROM table;
Is the same as
SELECT * FROM table LIMIT 0,10;
Here's an article about implementing Limit in MsSQL Its a nice read, specially the comments.
Clunky, but it'll work.
SELECT TOP 10 * FROM table WHERE id NOT IN (SELECT TOP 10 id FROM table ORDER BY id) FROM table ORDER BY id
MSSQL's omission of a LIMIT clause is criminal, IMO. You shouldn't have to do this kind of kludgy workaround.
In SQL there's no LIMIT keyword exists. If you only need a limited number of rows you should use a TOP keyword which is similar to a LIMIT.
最多设置5个标签!
Is the same as
Here's an article about implementing Limit in MsSQL Its a nice read, specially the comments.
Clunky, but it'll work.
MSSQL's omission of a LIMIT clause is criminal, IMO. You shouldn't have to do this kind of kludgy workaround.
In SQL there's no LIMIT keyword exists. If you only need a limited number of rows you should use a TOP keyword which is similar to a LIMIT.