在这个视图中时按时间查询重复数据中最新数据,其余数据不变!求解!
ALTER VIEW [dbo].[GetAllUser]ASSELECT Users_1.UID, Users_1.Email, Users_1.Mobile, Users_1.UserID, Users_1.PassWord, Users_1.UserRank, Users_1.IsState, Users_1.IsVIP,dbo.UserInfo.CreateTime, CASE WHEN charindex('.', '' + r.RUID + '') > 0 THEN replace(r.RUID, 'http://', '') WHEN r.RUID IS NULL THEN '--' ELSE (SELECT UserID FROM dbo.Users WHERE (UID = r.RUID)) END AS RUserID, v.ValPhone, dbo.UserInfo.QQ,udb.Reasons,udb.DisableTimeFROM dbo.Users AS Users_1 INNER JOIN dbo.UserInfo ON Users_1.UID = dbo.UserInfo.UID LEFT OUTER JOIN dbo.ReferrerInfo AS r ON Users_1.UID = r.UID LEFT OUTER JOIN dbo.UserValidation AS v ON Users_1.UID = v.UID LEFT OUTER JOIN dbo.UsersDisable as udb on Users_1.UID=udb.UIDGO