Re: update syntax
Posted in 1995
}From: alexmc@biccdc.co.uk (Alex McLintock) }Date: Thu, 16 Feb 1995 11:46:29 +0000 }X-Informix-List-Id: <news.11581> } }Pretty please could someone tell me what's wrong with }this update statement. Thanks } }update qprice, partmaster set qprice.qpmat = partmaster.curmat } where ( (qprice.qpson=27) AND (qprice.qpsonitem=103) } AND (qprice.qpqtyitem=1) } AND (partmaster.partnum='PC0651 A') }) } }I am trying to copy a field out of the partmaster table (curmat) }into a field of the same type in qprice (qpmat). The two records }concerned have keys partnum (a string) and for qprice }three numbers: qpson, qpsonitem, and qpqtyitem. I think this does what you want... UPDATE Qprice SET Qpmat = (SELECT Curmat FROM Partmaster WHERE Partnum = 'PC0651 A') WHERE Qpson = 27 AND Qpsonitem = 103 AND Qpqtyitem = 1; }Do I have to build an IN clause to this update statement? No. }I am told by non Informix database people that the above }statement is ANSI and should work. I think it is not ANSI as you can only update a single table. You cannot list multiple tables between the UPDATE and the SET keywords. Yours, Jonathan Leffler (johnl@informix.com) #include <disclaimer.h>