i need to join the records in different rows with same. like my TESTNAME is same project name in different row i need to club them and display it into one row also the query i used is for this is to make pivot please find the below code
select ProjectName,
ProjectNos,
isnull([Questionnaire Submission for sripting],'') as c1,
isnull([Programing of questionnaire and/or ConJoint Design/Email Send out],'') as c2,
isnull([Quality Check (Desktop and Mobile)],'') as c3,
isnull([Questionaire link sent to client for review],'') as c4,
isnull([Hard Launch],'') as c5,
isnull([Data Collection],'') as c6,
isnull([Quality Check (Sampling)],'') as c7,
isnull([Status of sampling process sent to client],'') as c8,
isnull([Data Exported & Cleansed],'') as c9,
isnull([Coding of Open Answers],'') as c10,
isnull([Table Report],'') as c11,
isnull([PPT Report],'') as c12,
isnull([Data Analysis],'') as c13,
isnull([Raw Data Delivery to CDT],'')as c14,
isnull([Quality Check ( Table Report/Raw Data)],'')as c15,
isnull([Power Point Quality Check ],'')as c16,
isnull([Final Presentation Delivery to CDT],'')as c17,
isnull([Extra Analysis (after presentation)],'')as c18,
isnull([N-visualize report],'')as c19,
isnull([Excel Delivery],'') as c20 from tbl_ProjectDetails
PIVOT (
max(Status_Name) for
[Task_assigned] IN
([Questionnaire Submission for sripting],
[Programing of questionnaire and/or ConJoint Design/Email Send out],
[Quality Check (Desktop and Mobile)],
[Questionaire link sent to client for review],
[Hard Launch],
[Data Collection],
[Quality Check (Sampling)],
[Status of sampling process sent to client],
[Data Exported & Cleansed ],
[Coding of Open Answers],
[Table Report],[PPT Report],
[Data Analysis],
[Raw Data Delivery to CDT],
[Quality Check ( Table Report/Raw Data)],
[Power Point Quality Check ],
[Final Presentation Delivery to CDT],
[Extra Analysis (after presentation)],
[N-visualize report],[Excel Delivery])) as pivottable where flag='0'
and its output as below
ProjectName ProjectNos c1 c2 c3 c4
test 123 123456 Not yet started
TESTNAME 45612 Alert
testfr 785412 Missed deadline
sdsd adsads Not Applicable
tyeuir 8948948 In progress
wwew 2324234234 Not yet started
TESTNAME 45612 Missed deadline
Try this:
select ProjectName,
ProjectNos,
isnull([Questionnaire Submission for sripting],'') as c1,
isnull([Programing of questionnaire and/or ConJoint Design/Email Send out],'') as c2,
isnull([Quality Check (Desktop and Mobile)],'') as c3,
isnull([Questionaire link sent to client for review],'') as c4,
isnull([Hard Launch],'') as c5,
isnull([Data Collection],'') as c6,
isnull([Quality Check (Sampling)],'') as c7,
isnull([Status of sampling process sent to client],'') as c8,
isnull([Data Exported & Cleansed],'') as c9,
isnull([Coding of Open Answers],'') as c10,
isnull([Table Report],'') as c11,
isnull([PPT Report],'') as c12,
isnull([Data Analysis],'') as c13,
isnull([Raw Data Delivery to CDT],'')as c14,
isnull([Quality Check ( Table Report/Raw Data)],'')as c15,
isnull([Power Point Quality Check ],'')as c16,
isnull([Final Presentation Delivery to CDT],'')as c17,
isnull([Extra Analysis (after presentation)],'')as c18,
isnull([N-visualize report],'')as c19,
isnull([Excel Delivery],'') as c20
from (
select ProjectName,
ProjectNos,
Status_Name,
[Task_assigned]
from tbl_ProjectDetails
where flag='0') as t
PIVOT (
max(Status_Name) for
[Task_assigned] IN
([Questionnaire Submission for sripting],
[Programing of questionnaire and/or ConJoint Design/Email Send out],
[Quality Check (Desktop and Mobile)],
[Questionaire link sent to client for review],
[Hard Launch],
[Data Collection],
[Quality Check (Sampling)],
[Status of sampling process sent to client],
[Data Exported & Cleansed ],
[Coding of Open Answers],
[Table Report],[PPT Report],
[Data Analysis],
[Raw Data Delivery to CDT],
[Quality Check ( Table Report/Raw Data)],
[Power Point Quality Check ],
[Final Presentation Delivery to CDT],
[Extra Analysis (after presentation)],
[N-visualize report],[Excel Delivery])) as pivottable
Result
ProjectName ProjectNos c1 c2 c3 c4 ...
-------------------------------------------------------------------------------
sdsd adsads Not Applicable
test 123 123456 Not yet started
testfr 785412 Missed deadline
TESTNAME 45612 Missed deadline Alert
tyeuir 8948948 In progress
wwew 2324234234 Not yet started
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.