在同一查询中使用JOIN和OFFSET

时间:2018-08-22 00:07:39

标签: sql-server tsql

如何将JOINOFFSET一起使用?

我注释掉了产生错误incorrect syntax near inner的行

ALTER PROCEDURE [dbo].[spPagination] -- ORDER BY id
    @PageNumber INT,
    @PageSize   INT
AS
BEGIN
    SET NOCOUNT ON;

    SELECT      
        Emp.id, Emp.[firstName], Emp.[lastName], Emp.[salary],  
        Emp.[startDateWork], Emp.age  --, Rol.[name] as Role
    FROM        
        [dbo].tblEmployees5m Emp
    ORDER BY    
        id
        -- INNER JOIN [dbo].[tblRoles] Rol ON Emp.roleId = Rol.id
        OFFSET @PageSize * (@PageNumber - 1) ROWS
        FETCH NEXT @PageSize ROWS ONLY 
    OPTION (RECOMPILE);
END

1 个答案:

答案 0 :(得分:1)

尝试一下。您的@Transaction职位不正确。

import '../node_modules/@webcomponents/webcomponentsjs/webcomponents-lite';
import '../node_modules/@webcomponents/webcomponentsjs/custom-elements-es5-adapter';