本文介绍了如果我获取所有用户数据我在列中获取单人记录(技能,平台,project_name,task_name)的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述 SELECT distinct TM_User.FullName,TM_Profile.profile, TM_User.Report_To, FROM TM_Userjoin TM_Profile on TM_Profile.ProfileID=TM_User.ProfileIDWHERE TM_User.Is_Active=1 and TM_User.TM_UserID=13 推荐答案 SELECT distinct TM_User.FullName,TM_Profile.profile, TM_User.Report_To, stuff(( SELECT distinct ', ' + Reference.lookupvalue FROM Reference join Reference_Skills on Reference.LookupID=Reference_Skills.SkillLookupKey join TM_UserAttributeValue on Reference_Skills.SkillLookupValue=TM_UserAttributeValue.AttributeValue join TM_User on TM_UserAttributeValue.TM_UserID=TM_User.TM_UserID where Reference.lookupkey='Platform' and TM_User.TM_UserID = u.TM_UserId FOR XML PATH('') ) ,1,2,'') as platfrom, stuff(( SELECT ', ' + Reference_Skills.SkillLookupValue FROM Reference_Skills join TM_UserAttributeValue on Reference_Skills.SkillLookupValue=TM_UserAttributeValue.AttributeValue join TM_User on TM_UserAttributeValue.TM_UserID=TM_User.TM_UserID where AttributeKeyType ='Skill' and TM_User.TM_UserID = u.TM_UserId FOR XML PATH('') ) ,1,2,'') as skills, STUFF( ( SELECT distinct ', ' + project_name FROM project JOIN task ON project.project_id = task.project_id JOIN timesheet ON timesheet.task_id = task.task_id join TM_user on TM_user.TM_UserID=timesheet.user_id WHERE project.status = 1 and TM_user.TM_UserID = u.TM_UserId FOR XML PATH ('') ), 1, 2, '') as project, STUFF( ( SELECT distinct ', ' + task_name FROM task JOIN project ON project.project_id = task.project_id JOIN timesheet ON timesheet.task_id = task.task_id join TM_user on TM_user.TM_UserID=timesheet.user_id WHERE project.status = 1 and TM_user.TM_UserID = u.TM_UserId FOR XML PATH ('') ), 1, 2, '') as task_nameFROM TM_User ujoin TM_Profile on TM_Profile.ProfileID=TM_User.ProfileIDWHERE TM_User.Is_Active=1 是我尝试过的,但真的不可能帮助,无需使用表和数据。is what I'd try, but it's impossible to really help without the tables and data to work with. 这篇关于如果我获取所有用户数据我在列中获取单人记录(技能,平台,project_name,task_name)的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持! 10-31 16:39