Thread: as400 - update query problem
-
May 29th, 2009, 06:07 PM #1Junior Member
- Join Date
- May 2009
- Posts
- 1
as400 - update query problem
The code below works in a SQL server environment, when I try to use the same in AS400 STrSQL I get a error message that I can not use Inner on a Update query.
UPDATE PWPTFILES/UPRM A INNER JOIN TGOMES/THUCSRMT B ON A.UPPRM =
B.UCPRM) INNER JOIN TGOMES/WRATELISTT C ON (C.UCSCOLD = B.UCSCH)
AND (B.UCSIZ = C.UCSIZ) AND (A.UPTYP = C.UPTYP)
SET B.UCSCH = C.UCSCHNEW
WHERE ((B.UCTYP='W') AND (B.UCACT=0) AND (B.UCCLD=0) AND
(A.UPRTE Not IN ( 0,1000,4000) AND C.UPTYP ='COM ')
How can I rewrite this into sql 400 and work!
Thanks
-
May 30th, 2009, 12:03 AM #2
Welcome to TechIMO!

I am moving your inquiry to the programming and development forum.Robert Richmond | Infinite perceptions. One reality.
TechIMO.com Editor-in-Chief
-
May 30th, 2009, 09:30 AM #3
Yeah, that can get a little tricky. Probably need something like:
Update table A
set A.value = '100'
where A.id= '1234'
and exists (select 'x'
from table B
where B.whatever = 'xyz'
and B.whomever = 123)
yada, yada
-
May 30th, 2009, 10:15 AM #4Not Really a Member
- Join Date
- Oct 2001
- Posts
- 27,856
-
May 30th, 2009, 07:37 PM #5
Just add another "and exists"
Update table A
set A.value = '100'
where A.id= '1234'
and exists (select 'x'
from table B
where B.whatever = 'xyz'
and B.whomever = 123)
and exists (selext 'x'
from table C
where C.thisever = 'abc'
and C.thiswhom = 123')
As my DBA's always tell me, it's hard to know what to do without knowing the data and the key structures of the underlying tables and how the keys from one table matches the other ones.
And part of this is ringing some distant bell in my head...like you can't select a column and use it in a join of the table you're updating??? Sometimes, I just have to write a little code snippet to run this type of stuff or have the DBA do a backdoor update (they hate that
)
Last edited by Rootstonian; May 30th, 2009 at 07:46 PM.
Thread Information
Users Browsing this Thread
There are currently 1 users browsing this thread. (0 members and 1 guests)
Similar Threads
-
as400-query
By nikolai1960 in forum Technical SupportReplies: 0Last Post: July 30th, 2008, 01:26 AM -
AS400 Query Help Needed
By tncamoman in forum General Tech DiscussionReplies: 0Last Post: March 21st, 2006, 12:32 PM -
AS400 Query Help!!!!!!!!!!!!!
By pea333nut in forum Webmastering and ProgrammingReplies: 0Last Post: September 2nd, 2004, 12:54 PM -
Access query problem
By SlipGun in forum Webmastering and ProgrammingReplies: 9Last Post: April 15th, 2002, 09:24 PM -
Update Query in MS Access 2000
By ctaylor in forum Webmastering and ProgrammingReplies: 11Last Post: March 2nd, 2002, 04:45 PM



LinkBack URL
About LinkBacks



Reply With Quote

Nope. My hotel is about 7 miles from the airport, and I'll be working at a facility right next to the airport.
Is It Just Me? v233893843