Stacey
That was precisely what I was hoping I could do - that capability seems consistent with "INSERT INTO" ...
Regards,
Mike
----- Original Message -----
Sent: Thursday, February 24, 2000 7:28 AM
Subject: RE: [DUG-DB]: Basic SQL Question - UPDATE

In Informix we can do
 
update TblTarget
set (col2, col3, col5)
= (select col2, col3, col4 where ....)
where
col1 = ??
 
I'm not sure if other servers have this syntax.
-----Original Message-----
From: Mike Osborne [mailto:[EMAIL PROTECTED]]
Sent: Wednesday, 23 February 2000 17:06
To: Multiple recipients of list database
Subject: [DUG-DB]: Basic SQL Question - UPDATE

I would like to update some columns of specific rows in a table (TblTarget) with values from a specific row from another table (TblSource).
 
Is there a way that this can be done in a single SQL statement (and more concise than what follows)?
 
It looks like
 
UPDATE TblTarget set
col2 = (select col2 from TblSource where ...),
col3 = (select col3 from TblSource where ...),
col5 = (select col5 from TblSource where ...)
where
col1 = some_value
 
is possible but seems very long-winded expecially since the "select's" all test for the same condition and I'm wanting to deal to 9 columns with 3 compares in each select "where" subclause.
 
Other options are select from TblSource first and apply the result as parameters for each "set" (col2 = :col2, col3 = :col3 ...)
 
Or, join TblTarget & TblSource to give a query of an image of the updated rows and apply through BatchMove with Mode batUpdate.
 
What is the tidiest/optimal method to do this?
 
Currently using Paradox, Delphi 4, but interested if more/better options available under InterBase as migrating in the near future..
 

Reply via email to