If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > Joined update

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-21-04, 17:13
maddog260013 maddog260013 is offline
Registered User
 
Join Date: Apr 2004
Location: NJ United States
Posts: 4
Exclamation Joined update

HI all,

I need to update a table from data in a view. I am using version 6.1.

UPDATE shipto INNER JOIN discounts ON shipto.strfnbr=discounts.strfnbr SET stfield2 = discounts.(char(stdiscprice)) WHERE shipto.stfield2 is null

I get:

SQL0104N An unexpected token "UPDATE shipto INNER" was found following

"BEGIN-OF-STATEMENT".
Reply With Quote
  #2 (permalink)  
Old 04-21-04, 17:42
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Re: Joined update

Quote:
Originally posted by maddog260013
HI all,

I need to update a table from data in a view. I am using version 6.1.

UPDATE shipto INNER JOIN discounts ON shipto.strfnbr=discounts.strfnbr SET stfield2 = discounts.(char(stdiscprice)) WHERE shipto.stfield2 is null

I get:

SQL0104N An unexpected token "UPDATE shipto INNER" was found following

"BEGIN-OF-STATEMENT".
I think this should work:

update shipto
set stfield2 = (
select char(stdisprice) from discounts
where discounts.strfnbr=shipto.strfnbr
)
where stfield2 is null
Reply With Quote
  #3 (permalink)  
Old 04-22-04, 10:27
maddog260013 maddog260013 is offline
Registered User
 
Join Date: Apr 2004
Location: NJ United States
Posts: 4
Re: Joined update

This was just what I needed. Thank you n_i!


Quote:
Originally posted by n_i
I think this should work:

update shipto
set stfield2 = (
select char(stdisprice) from discounts
where discounts.strfnbr=shipto.strfnbr
)
where stfield2 is null
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On