Hi.

With MySQL, there is not (yet) a way to do this with a single
command. A poor SQL work-around is possible, but a bit bloated.

On the other hand, ta.f1 is a redundand field (regarding tb.af1) and
therefore you normally would seldom need a command such as the one
below.

One (quite probably not the best) solution would be:

LOCK TABLE new_ta WRITE, ta WRITE, tb READ;
CREATE TABLE new_ta (...field list...) \
  SELECT ta.id, tb.af1, other_ta_fields FROM ta, tb WHERE ta.id=tb.id;
DROP TABLE ta;
ALTER TABLE new_ta RENAME ta;
UNLOCK TABLES;

This is not tested, but you surely get the idea.

Bye,

        Benjamin.

On Sun, Sep 30, 2001 at 10:26:29AM +0800, [EMAIL PROTECTED] wrote:
> Hi all,
> 
> I am new in mysql and want to analyse between some popular databases. I have
> a SQL:
> 
> update ta set f1 = ( select af1 from tb where ta.id = tb.id );
> 
> It can be done in postgreSQL and Oracle. How can I do the same tasks in
> MySQL without using Perl? Is it possible to do this tasks just enter the SQL
> statement?
> 
> Kenenth.

-- 
[EMAIL PROTECTED]

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