Dear Experts,
I have a result of query in @Query which is showing data properly. I have to joint that result with the table result_mst on transno (both side). How could I do that, please guide.
The @query number of columns not confirm. Is there any possibility to insert @query result into temp table directly instead of creating #query_result table because no of column is not confirm
Please see code:
SET @query = N'SELECT Transno, ExamCode,' + @slct + ' FROM (SELECT Transno,ExamCode,SN,ObtMarks FROM #Result) AS p PIVOT ( MAX([ObtMarks]) FOR SN IN ( ' + @cols + ' )) AS pvt ORDER BY Transno, ExamCode;'--SELECT @queryInto #Query_ResultEXECUTE(@query)
Please see code:
Open in new window