• Subject: Re: UPDATE primary file with JOIN?
  • From: "R. Bruce Hoffman, Jr." <rbruceh@xxxxxxxxxxxxx>
  • Date: Sun, 14 Nov 1999 21:18:26 -0500

Yup.

Given two tables...

create table a (fielda char(1), fieldb char(2))
create table b (field1 char(1), field2 char(2))

You can do this.....

 update a
  set fieldb = (select field2 from b where field1 = fielda)

Notice that it is not a join and you can't do this in V4R2 and prior.


===========================================================
R. Bruce Hoffman, Jr.
 -- IBM Certified AS/400 Professional System Administrator
 -- IBM Certified AS/400 Professional Network Administrator

"The sum of all human knowledge is a fixed constant.
    It's the population that keeps growing!"

-----Original Message-----
From: Jack Crouch <j.crouch@ssss.com>
To: 'MIDRANGE-L@midrange.com' <MIDRANGE-L@midrange.com>
Date: Sunday, November 14, 1999 5:23 PM
Subject: UPDATE primary file with JOIN?


>I have enjoyed years of being able to use the UPDATE and DELETE commands
>from ASC's Sequel products while using the JOIN clause.   Only the primary
>file is updated.
>
>I have a new box without Sequel.    I am trying to get back to the crude
>SQL/400 environment.   I read a book by James Coolbaugh called SQL/400 by
>Example.   In here he has the mysterious statement:   "For our
understanding
>here, you need to know that starting with V4R3, you can update a field with
>information from another file."
>
>Well, that all he says about it.    And SQL/400 does not expect the JOIN
>clause in the UPDATE.    Can someone elaborate on what he might have meant
>by this?
>
>Thanks,
>Jack D. Crouch
>Director of Information Systems
>Stewart & Stevenson
>
>Email: j.crouch@ssss.com
>
>+---
>| This is the Midrange System Mailing List!
>| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
>| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
>| To unsubscribe from this list send email to
MIDRANGE-L-UNSUB@midrange.com.
>| Questions should be directed to the list owner/operator:
david@midrange.com
>+---
>

+---
| This is the Midrange System Mailing List!
| To submit a new message, send your mail to MIDRANGE-L@midrange.com.
| To subscribe to this list send email to MIDRANGE-L-SUB@midrange.com.
| To unsubscribe from this list send email to MIDRANGE-L-UNSUB@midrange.com.
| Questions should be directed to the list owner/operator: david@midrange.com
+---

As an Amazon Associate we earn from qualifying purchases.

This thread ...


Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.