TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Jes Sie
744
1.2k
282.2k
Inner Joins, Coalesce and Pivot
Mar 26 2018 10:52 PM
Can someone help me with this error?
Below is the code:
declare
@cols
varchar
(1000)
declare
@sqls
varchar
(2000)
select
@cols =
COALESCE
(@cols +
', '
,
''
) + QUOTENAME(t.TermCode)
from
tblFinalGradeDetails fg
INNER
JOIN
tblTermMaster t
ON
fg.TermId = t.TermId
Group
by
t.TermCode
SELECT
@sqls = '
select
*
from
(
select
fg.StudentID, fg.StudentName, t.TermCode, fg.FinalGrade
from
tblFinalGradeDetails fg
INNER
JOIN
tblTermMaster t
ON
fg.TermId = t.TermId
WHERE
fg.SchoolCode =
''
ISL
''
and
fg.SchoolYear =
''
SY201718
''
) src
PIVOT (
sum
(fg.FinalGrade)
FOR
t.TermCode
IN
(
' + @cols + '
)) pvt '
EXEC
(@sqls)
I don't have any problems or issues without the joins but with the joins, I got that error. Thanks so much for any extended help.
Reply
Answers (
3
)
can anyone help me why object as parameter is used ?wpf MVVM
Techonologies to Learn In Relation to ASP.Net WebApi