OSEC

Neohapsis is currently accepting applications for employment. For more information, please visit our website www.neohapsis.com or email hr@neohapsis.com
 
FW: (SOLVED) Update from tables?

Kevin.Wilsoncomtrol.com
Date: Wed Feb 18 2004 - 14:09:37 CST


HERE IS THE SYNTAX THAT DOES WORK. SEEMS LIKE SAPDB DOESN'T LIKE YOU TO USE
PSUEDO TABLE NAMES:

UPDATE USERDB.RMA SET ITEM_TOTAL = (SELECT (SUM(WARRANTY_CHARGE) +
SUM(LABOR_CHARGE) + SUM(PARTS_CHARGE)) FROM USERDB.RMA_ITEM WHERE RMA_ID =
2045001 AND ACTIVE='Y') WHERE RMA_ID = 2045001

UPDATE USERDB.RMA SET RMA_TOTAL = (SELECT (SUM(ITEM_TOTAL) +
SUM(MISC_CHARGE) + SUM(FREIGHT_CHARGE)) FROM USERDB.RMA WHERE RMA_ID =
2045001 AND ACTIVE='Y') WHERE RMA_ID = 2045001 AND ACTIVE='Y'

-----Original Message-----
From: Kevin Wilson
Sent: Wednesday, February 18, 2004 11:59 AM
To: maxdblists.mysql.com
Subject: FW: Update from tables?

This one doesn't work either:

Auto Commit: On, SQL Mode: Internal, Isolation Level: Committed
General error;-5016 POS(27) Missing delimiter: =.
UPDATE USERDB.RMA R SET R.RMA_TOTAL = (SUM(R.ITEM_TOTAL) +
SUM(R.MISC_CHARGE) + SUM(R.FREIGHT_CHARGE)) WHERE R.RMA_ID = 2045001 AND
R.ACTIVE='Y';

-----Original Message-----
From: Kevin Wilson
Sent: Wednesday, February 18, 2004 9:27 AM
To: elke.zabachsap.com; romuloacerosocotlan.com.mx;
maxdblists.mysql.com
Subject: RE: Update from tables?

Well this isn't necessarily true because if it were then this statement
would work:

UPDATE USERDB.RMA A SET A.ITEM_TOTAL = (SELECT (SUM(B.WARRANTY_CHARGE) +
SUM(B.LABOR_CHARGE) + SUM(B.PARTS_CHARGE)) FROM USERDB.RMA_ITEM B WHERE
B.RMA_ID = 2045001 AND B.ACTIVE='Y') WHERE A.RMA_ID = 2045001;

error = General error;-5016 POS(27) Missing delimiter: =.

running sapdb v7.4.0.46 on SuSE Linux

-----Original Message-----
From: Zabach, Elke [mailto:elke.zabachsap.com]
Sent: Tuesday, February 17, 2004 12:19 AM
To: 'José Rómulo Elías Contreras'; maxdblists.mysql.com
Subject: RE: Update from tables?

 José Rómulo Elías Contreras wrote:

>
> How can I do an update of a table usign values from different
> tables to
> set it?
>
Use subqueries like this:
UPDATE t SET a = (SELECT col FROM base)

Elke
SAP Labs Berlin

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:
http://lists.mysql.com/maxdb?unsub=kevin.wilsoncomtrol.com

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:
http://lists.mysql.com/maxdb?unsub=kevin.wilsoncomtrol.com

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb
To unsubscribe:
http://lists.mysql.com/maxdb?unsub=kevin.wilsoncomtrol.com

--
MaxDB Discussion Mailing List
For list archives: http://lists.mysql.com/maxdb