SQL限制错误

时间:2014-08-07 18:44:08

标签: sql sql-server

我有这样的查询:

SELECT * FROM dbo.ScheduledatesFF AS a INNER JOIN
                      dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN
                      dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN
                      dbo.maxscheddate AS m ON a.Job_No = m.Job_No LIMIT 10;

但是我收到错误,说'LIMIT'附近的语法不正确。我做错了什么?

1 个答案:

答案 0 :(得分:3)

使用

SELECT TOP 10 * FROM dbo.ScheduledatesFF AS a INNER JOIN
    dbo.tblCustomers AS c ON a.Job_No = c.Job_No INNER JOIN
    dbo.scheduledatesSS AS z ON a.Job_No = z.Job_No LEFT OUTER JOIN
    dbo.maxscheddate AS m ON a.Job_No = m.Job_No

SQL Server使用TOP N语法而不是LIMIT N