sql - How to trim emails in a column and at the same time remove duplicates (MSQL2017, UPDATE column) -
i have table data 1 of them emails stored in column called "domain".
i need update "domain" cut emails , leave domains (example: test@testmail.com
after query testmail.com
).
so domain
column has on 290000 emails stored inside , there null's...
said looking domains , don't need data left of , including @
don't need duplicated domain list or null
values in domain
column.
so looking query trim emails transform them domains @ same time query remove data null
value , duplicated domains.
the final result should column domain
unique domains , without nulls inside.
as simple as:
select distinct right(email, len(email) - charindex('@', email)) email_domain table email not null;
Comments
Post a Comment