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

Trova record non duplicati, esclusi i valori null, in base a un campo.

select min(id), dat1 from table where dat1 is not null group by dat1 
union
select id     , dat  from table where dat1 is null