View Full Version : update with select possible ???
Guest.Visitor
12-18-2002, 07:08 AM
You are getting a count of 1 because of the grouping on inv#. Try using a union query where the first select is the invoices for the customer and the union select is the count of the invoices and summary for the customer. Then you can start trying the select for update command
Absolutely_Nobody
12-18-2002, 07:08 AM
I have a need to determine invoice totals, a count of invoices and update a field in the invoice file to specify that the records have been processed. I have the following SQL select inv#, sum(invamt), count(*) rows from inv where cust# = '123' and invtyp = 'L' group by inv# However, this give me a count of 1 for each row. How can I get a count of invoice processed ? Also, I need to update a flag in each invoice record processed. Would I need to write another SQL statement to to that or is there a way to do that within the select above ? If I need to execute another SQL to update each record would it be more efficient to do it in RPG since I can update each record as I read it to accumulate totals ? Would executing two SQL statements be inefficient ?
Powered by vBulletin® Version 4.1.5 Copyright © 2013 vBulletin Solutions, Inc. All rights reserved.