blob: 4d75b4e7fe38e0f6c01a0326f58987b53e9a2b46 (
plain)
1
2
3
4
5
6
7
8
9
|
use test;
drop table if exists t1,t2;
create table t1 (email varchar(50));
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
create table t2(id int not null auto_increment primary key,
t2 varchar(50), unique(t2));
insert into t2 (t2) select distinct substring(email, locate('@', email)+1) from t1;
select * from t2;
|