Sqlserver
 sql >> Database >  >> RDS >> Sqlserver

Comprimi le righe con valori nulli e duplicati in righe singole

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