On Mon, Aug 25, 2003 at 07:10:02PM -0400, Dan Jones wrote:
> On Thu, 2003-08-21 at 20:21, Taylor Sittler wrote:
> > Is there any way to update table values based on values in another table?
> > 
> > For instance, given:
> > <table (column1,column2..)>
> > Table 1 (jobid, jobname)
> > Table 2 (person, jobid, jobname)
> > 
> > could I update Table 2, setting jobname=Table1.jobname where 
> > Table1.jobid=Table.jobid?  Is it possible to do this in one SQL command, 
> > so that SQL matches the updating set to the stored set?
> 
> UPDATE Table1, Table2 SET Table2.jobname=Table1.jobname WHERE
> Table2.jobid=Table1.jobid;
> 

Not in 3.23.xx.

You would need to do this from a programming language or possibly by
creative use of temporary tables (SELECT INTO temp ...; REPLACE INTO
`Table 2`(...) SELECT * FROM temp; with appropriate locking).


Regards,

Fred.

-- 
Fred van Engen                              XB Networks B.V.
email: [EMAIL PROTECTED]                Televisieweg 2
tel: +31 36 5462400                         1322 AC  Almere
fax: +31 36 5462424                         The Netherlands

-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to