Sqlserver
 sql >> Base de Dados >  >> RDS >> Sqlserver

Compactar linhas com nulos e duplicados em linhas únicas

Select
   ID,
   AssnDate,
   AssnTxt,
   Max(IsNull(Sally,0)) AS Sally,
   Max(IsNull(Ted, 0)) As Ted,
   Max(IsNull(Bob, 0)) As Bob
From vwGrades
Group By
  ID,
  AssnDate,
  AssnTxt