sql >> Base de Datos >  >> RDS >> Sqlserver

Comprimir filas con nulos y duplicados en filas individuales

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