sql - Find non-duplicate records, excluding nulls, based on one field. -


i want find unique records in dat1 field, want every single null record returned. doesn't matter duplicate record dropped.

example table:

+----+--------------+ | id |     dat1     | +----+--------------+ |  1 | 11@email.com | |  2 | 11@email.com | |  3 | null         | |  4 | null         | |  5 | 99@email.com | |  6 | 99@email.com | +----+--------------+ 

desired result:

+----+--------------+ | id |     dat1     | +----+--------------+ |  1 | 11@email.com | |  3 | null         | |  4 | null         | |  5 | 99@email.com | +----+--------------+ 

is possible? tried couple of approaches sub-queries couldn't quite pull off.

select min(id), dat1 table dat1 not null group dat1  union select id     , dat  table dat1 null 

Comments

Popular posts from this blog

html - Styling progress bar with inline style -

java - Oracle Sql developer error: could not install some modules -

How to use autoclose brackets in Jupyter notebook? -