could not create a list of fields for the query [closed]

≯℡__Kan透↙ 提交于 2019-12-11 18:59:27

问题


I am clicking on REFRESH FIELDS for my query for a shared dataset, and getting this error:

here's my query:

Select
            p.AgeCodePL ,
p.BirthDate ,
p.CommunityIDY  ,
p.Company   ,
p.CreatedbyUser ,
p.DateCreated   ,
p.DateExpired   ,
p.DateUpdated   ,
p.Department    ,
p.EthnicityFK   ,
p.FirstName firstFirstName,
p.GenderUL  ,
p.LastName  ,
p.MaritalStatusUL   ,
p.MiddleName    ,
p.NickName  ,
p.PeopleIDY ,
p.PrefixUL  ,
p.RaceUL    ,
p.ReligionUL    ,
p.Salutation    ,
p.SpouseName    ,
p.SSN   ,
p.SuffixUL  ,
p.Title ,
p.UpdatedbyUser ,
r.ACT_ID    ,
r.HEA_ID    ,
r.INT_ID    ,
r.LIF_ID    ,
r.NetworkSet    ,
r.PER_ID    ,
r.RES_Active    ,
r.RES_Bio   ,
r.RES_BioUpdate ,
r.RES_BioUpdateBy   ,
r.RES_CommunityIDY  ,
r.RES_CurrentUnitNumber ,
r.RES_DateStarted   ,
r.RES_DiscNotes1    ,
r.RES_DiscNotes2    ,
r.RES_DiscNotes3    ,
r.RES_DiscNotes4    ,
r.RES_DiscNotes5    ,
r.RES_ExpiredDate   ,
r.RES_ExpiredUser   ,
r.RES_FinishedDate  ,
r.RES_HasImage  ,
r.RES_LastUserUpdated   ,
r.RES_LobbyBio  ,
r.RES_LobbyBioUpdate    ,
r.RES_LobbyBioUpdateBy  ,
r.RES_NoPart    ,
r.RES_PeopleIDY ,
r.RES_PhyMoveInDate ,
r.RES_TasksSet  ,
r.RES_UpdatedImage  ,
r.STA_ID    ,
r.STA_Type  ,
r.TES_ID    ,
rr.CommunityIDY ,
rr.CurrentUnitNumber    ,
rr.Gender   ,
rr.MainBirthDate    ,
rr.MainFirstName    ,
rr.MainLastName ,
rr.MainPeopleIDY    ,
rr.Name ,
rr.ProspectIDY  ,
s.RES_ID    ,
s.STA_Active    ,
s.STA_CreatedOn ,
s.STA_DateUpdated   ,
s.STA_Details   ,
s.STA_EditedDate    ,
s.STA_EditedUser    ,
s.STA_ID    ,
s.STA_Reason    ,
s.STA_Solution  ,
s.STA_Type  ,
s.STA_User  ,
u.PRO_ID    ,
u.STU_ID    ,
u.TEA_ID    ,
u.USR_AboutMe   ,
u.USR_Active    ,
u.USR_AllComm   ,
u.USR_Bday  ,
u.USR_BdayDay   ,
u.USR_CellPhone ,
u.USR_CommLocation  ,
u.USR_CommunityIDY  ,
u.USR_ContactFor    ,
u.USR_DirectPhone   ,
u.USR_Email ,
u.USR_EntAdmin  ,
u.USR_FavBooks  ,
u.USR_FavMovies ,
u.USR_FavPart   ,
u.USR_FavQuotes ,
u.USR_Fax   ,
u.USR_First ,
u.USR_Goals ,
u.USR_HasImage  ,
u.USR_HomeTown  ,
u.USR_ID    ,
u.USR_Interests ,
u.USR_INTL_Password ,
u.USR_INTL_UserName ,
u.USR_IsSales   ,
u.USR_JoinedKisco   ,
u.USR_Last  ,
u.USR_LastLogin ,
u.USR_LastProUpdate ,
u.USR_Name  ,
u.USR_OtherTeams    ,
u.USR_Password  ,
u.USR_PlacesBeen    ,
u.USR_REPS_Password ,
u.USR_REPS_UserIDY  ,
u.USR_REPS_UserName ,
u.USR_Role  ,
u.USR_RoleDescrip   

            from
            Status s
            Inner Join Residents r
            ON r.RES_ID = s.RES_ID
            Left Join REPSResidents rr
            ON rr.MainPeopleIDY = r.RES_PeopleIDY
            Inner Join Associate u
            ON s.STA_User = u.USR_ID
            Inner Join KSLSQL1.[RPS-201065-000].dbo.people p
            ON r.RES_PeopleIDY = p.PeopleIDY
            Where
            rr.CommunityIDY in (@Community)
            and (s.STA_Reason is not null and s.STA_Reason <> '')
and s.STA_Active = 1
and s.STA_DateUpdated between @BegDate and dateadd(d,1,@EndDate)
Order by
s.STA_DateUpdated DESC

what am i doing wrong?


回答1:


The issue is because you have two columns with the exact same name in your query:

r.RES_ID    ,
s.RES_ID    ,

The columns must have different names. Either give them an alias to make them distinct or remove one of them, since they will have identical values based on your join.



来源:https://stackoverflow.com/questions/17304371/could-not-create-a-list-of-fields-for-the-query

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!