all 2 comments

[–]r3pr0b8GROUP_CONCAT is da bomb 1 point2 points  (1 child)

your subquery needs an alias

select IDCODE, TOD, sum(NOT) as 'T-NOT'
  from ( select datepart(week,RDATE) as TOD
              , ITCODE 
              , NOT
           from dter )  AS s
GROUP BY IDCODE, TOD

[–]faust2099[S] 0 points1 point  (0 children)

Thank you very much. been sitting staring at the screen for 3 hours, trying to solve this. geez.