SQL语句大全

2021/6/3 19:22:02

本文主要是介绍SQL语句大全,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

分页SQL语句整理

分页SQL语句01:

pageSize:表示每一页要取多少条。如10条

pageIndex:表示页码,第几页。

SELECT  TOP pageSize * FROM (SELECT ROW_NUMBER() over(order by CID desc) as rows, CID,C_Pic,C_Name,C_Price,C_Description,C_Category,C_Author,C_Lecturer,C_Label,C_URL,UI.UserName,CC.Cc_Name,C_Recommend,C_Content FROM a_CourseList CL LEFT JOIN a_UserInfo UI ON UI.UID = CL.C_Lecturer LEFT JOIN a_CourseCategory CC ON CC.CcId=CL.C_Category WHERE CC.Cc_Author = 1 AND C_State=1 AND C_IsDel=0 AND C_Author=16) AS T where T.rows> (pageindex-1) * pageSize

 

 

left joio

select F.FbId,F.Context, U.HeadPic,U.UserName,D.D_Name,P.P_Name from a_Feedback as F
left join a_UserInfo as U on U.UID=F.UId
left join a_Department as D on D.Uid=U.UID
left join a_Position as P on P.Uid=D.Uid where F.UId=17

 



这篇关于SQL语句大全的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程