INSERT INTO table1 (email) 
SELECT email FROM table1, table2 WHERE table1.email <> table2.email;

the select is a "new" query, you have to join table1 and table2...

Regards,
Johan Nilsson
Software Developer
BeCon Mobile Internet AB, Sweden
Web: http://www.beconmobile.com
E-Mail: [EMAIL PROTECTED]
Office: +46 457 44184
Cellular: +46 709 798897

> -----Ursprungligt meddelande-----
> Fran: Martin Cabrera Diaubalick [mailto:[EMAIL PROTECTED]]
> Skickat: den 20 juli 2001 13:14
> Till: [EMAIL PROTECTED]
> Kopia: [EMAIL PROTECTED]
> Amne: Anyone knows what's wrong with this INSERT sentence?
> 
> 
> 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
> 
> Regards
> 
> 
> 
> ---------------------------------------------------------------------
> 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
> 
> 

---------------------------------------------------------------------
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

Reply via email to