Vadim,
Monday, April 29, 2002, 7:10:27 PM, you wrote:

V> My company migrated to MySQL a few months ago from Sybase Adaptive
V> Server Anywhere. Where I'm very impressed with the performance and the
V> simplicity of management I find its very difficult, however, to run
V> regular updates or deletes because joins are not supported on delete and
V> update. I can live without stored procedures, triggers and views
V> (although, they are very useful simply can not function as a DBA /SQL
V> developer without being able to perform simple delete on a table set
V> based on the result of a join. 

V> Can someone, please, show me an example on how can I delete/update table
V> based on the records in another tables. This is query that works on ASA:

V> delete from t1
V>         from t1, t2 
V>                 where t1.col1 = t2.col1 
V>                 and t2.col2 is NULL ;

V> update t1, t2 
V>                 set t1.col='' 
V>                 where t1.col1 = t2.col1 
V>                 and t2.col2 is NULL

Create script with SQL statement:

SELECT CONCAT('UPDATE t1 SET t1.col=\'\' WHERE t1.col1 = ', t1.col1, ';')
FROM t1, t2
WHERE t1.col1= t2.col1
AND t2.col2 IS NULL;

and then run the script as described in the manual:
    http://www.mysql.com/doc/A/N/ANSI_diff_Sub-selects.html


V> This syntax does not work in MySQL. 

V> Thank you very much for you time.
V> Vadim Kulikov





-- 
For technical support contracts, goto https://order.mysql.com/
This email is sponsored by Ensita.net http://www.ensita.net/
   __  ___     ___ ____  __
  /  |/  /_ __/ __/ __ \/ /    Egor Egorov
 / /|_/ / // /\ \/ /_/ / /__   [EMAIL PROTECTED]
/_/  /_/\_, /___/\___\_\___/   MySQL AB / Ensita.net
       <___/   www.mysql.com



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