Martin Cabrera Diaubalick wrote:
> Hello all,
>
> I have this two tables : table1,table2 . I would like to include all emails from
>table2 into table1 removing duplicates.
>
> INSERT INTO table1 (email) SELECT email from table2 where table1.email <>
>table2.email;
>
> MYSQL says: ERROR 1109: Unknown table 'table1' in where clause
>
> Both tables exist, what's wrong?
>
> TIA
>
Hi
First, select "FROM table1, table2" if you want to do a join.
Then your where close will not work with "<>" (I think).
try something like :
insert into table1 select distinct email from table2
which will do exactly what you want.
Remember to check the mysql doc (references) to learn how to use SQL.
Cheers,
Prune
--
- le Centre -
a Mad Cow Tribe product
(Very uncommon, but we should please everybody anyway, even disturbed minds)
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php