这条sql语句报错提示是:无法绑定由多个部分组成的标识符 "U.CreateDate",各位大神帮忙看一下
Select*From(SelectROW_NUMBER()Over(OrderByU.CreateDateDesc)AsrowNum,*From(SELECTU.Use...
Select * From (Select ROW_NUMBER() Over (Order By U.CreateDate Desc) As rowNum, * From (SELECT U.User_ID as [KEY],b.organization_code as 部门编号,U.User_Code as 用户编号,U.User_Name as 用户姓名,(case U.User_Sex when 1 then '男' when 0 then '女' else '未知' end) as 性别,U.CreateDate as 时间from Base_UserInfo U LEFT JOIN Base_StaffOrganize S ON U.User_ID = S.User_ID left join Base_Organization as b on S.organization_ID=b.organization_ID where U.DeleteMark !=0 AND U.xiaoquDdtCode='0203' GROUP BY U.User_ID,U.User_Code,U.CreateDate,U.User_Name,U.User_Sex,b.organization_code) As T ) As N Where rowNum > 0 And rowNum <= 15
展开
2个回答
展开全部
Select * From (
Select ROW_NUMBER() Over (Order By T.时间 Desc) As rowNum, * From (
SELECT U.User_ID as [KEY]
,b.organization_code as 部门编号
,U.User_Code as 用户编号
,U.User_Name as 用户姓名
,(case U.User_Sex when 1 then '男' when 0 then '女' else '未知' end) as 性别
,U.CreateDate as 时间
from Base_UserInfo U
LEFT JOIN Base_StaffOrganize S ON U.User_ID = S.User_ID
left join Base_Organization as b on S.organization_ID=b.organization_ID
where U.DeleteMark !=0 AND U.xiaoquDdtCode='0203'
GROUP BY U.User_ID,U.User_Code,U.CreateDate
,U.User_Name,U.User_Sex,b.organization_code
) As T
) As N Where rowNum > 0 And rowNum <= 15
把第一个U.CreateDate换成T.时间就可以了。
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询