|
This should work: Update Customer a set Customer_Store = (select 'C'||Customer_Store from Customer where Cust#=a.Cust# and Company=1) where Company=2 Perhaps you'd have to change it to: (select 'C'||substr(Customer_Store, 1, n) from ... where n is the length of field Customer_Store. Saludos, --------------------------- Santiago Martí Dusen, S.A. --------------------------- "Rowe, Sheri" <srowe@xxxxxxxxx> Enviado por: Para rpg400-l-bounces@ <rpg400-l@xxxxxxxxxxxx> midrange.com cc Asunto 15/02/2007 17:58 sql update Por favor, responda a RPG programming on the AS400 / iSeries <rpg400-l@midrang e.com> I am trying to run an interactive SQL to update a field in a file with the value from the same field, from another record in the same file, based on common customer numbers. Here is an example. Customer Cust# Company Customer_Store 17201111 1 C001111 17201111 2 17202222 1 C002222 17202222 2 I want to update a range of customer numbers and take the Customer_Store for Company 1 and put that store number in the same customer number for Company 2, minus the leading 'C'. So my file would look like this, once my successful sql runs. Customer Cust# Company Customer_Store 17201111 1 C001111 17201111 2 001111 17202222 1 C002222 17202222 2 002222 Fields Cust# and Company are Zoned and Customer_Store is Char. TIA for any assistance. Sheri -- This is the RPG programming on the AS400 / iSeries (RPG400-L) mailing list To post a message email: RPG400-L@xxxxxxxxxxxx To subscribe, unsubscribe, or change list options, visit: http://lists.midrange.com/mailman/listinfo/rpg400-l or email: RPG400-L-request@xxxxxxxxxxxx Before posting, please take a moment to review the archives at http://archive.midrange.com/rpg400-l.
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 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.