2000-10-18 19:58:06 +02:00
|
|
|
use test;
|
2003-01-06 00:48:59 +01:00
|
|
|
--disable_warnings
|
2000-12-28 02:56:38 +01:00
|
|
|
drop table if exists t1,t2;
|
2003-01-06 00:48:59 +01:00
|
|
|
--enable_warnings
|
|
|
|
|
2000-12-28 02:56:38 +01:00
|
|
|
create table t1 (email varchar(50));
|
|
|
|
insert into t1 values ('sasha@mysql.com'),('monty@mysql.com'),
|
2000-10-18 19:58:06 +02:00
|
|
|
('foo@hotmail.com'),('foo@aol.com'),('bar@aol.com');
|
2000-12-28 02:56:38 +01:00
|
|
|
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;
|