sql多表联合查询语句该怎么写

如题,看看这个语句分页要怎么写

SELECT TOP 10 A.User_Code,A.User_Sex,C.PropertyInstance_Value,A.PhoneNo FROM Base_UserInfo A,
Base_UserRole B,

Base_AppendPropertyInstance C

WHERE A.User_ID=B.User_ID AND

B.User_ID=C.PropertyInstance_Key AND

C.Property_Control_ID='ChatName'

繁花如伊
浏览 582回答 3
3回答

aluckdog

DECLARE @pageSize INT =10, @pageIndex INT=1 SELECT * FROM ( SELECT ROW_NUMBER() OVER(ORDER BY User_ID) AS rowNum, A.User_Code, A.User_Sex, C.PropertyInstance_Value, A.PhoneNo FROM Base_UserInfo A,Base_UserRole B,Base_AppendPropertyInstance C WHERE A.User_ID=B.User_ID AND B.User_ID=C.PropertyInstance_Key AND C.Property_Control_ID='ChatName' ) AS tb WHERE tb.rowNum BETWEEN @pageIndex-1 * @pageSize AND @pageIndex * @pageSize

慕姐4208626

有一种分页叫 row_number
打开App,查看更多内容
随时随地看视频慕课网APP

相关分类

SQL Server