Would it be better to use SQL or RPG, to update one field in the file with a value from another field in the same file? I am not that familiar with SQL, only a beginner. My RPG skills are rusty as I've not written anything in the last 4 years.
Software/Hardware used:
ASKED:
May 6, 2009 3:22 PM
UPDATED:
May 8, 2009 10:39 AM
Hi,
Just another thought – if you only need to update a couple of records you could also use DFU. Use the command UPDDTA.
Regards,
Martin Gilbert.
Is it possible to do a “Multiplacation” in SQL… ? Using the example from Gilly400, instead of adding the Postage stamp, could I multiply by a fixed % instead?
Hi,
Yes, no problem. eg add 10% to total price :-
UPDATE product_file SET total_price = (total_price + (total_price * 0.10))
Or
UPDATE product_file SET total_price = (total_price * 1.10)
Regards,
Martin Gilbert.
Try this…
MyFile contains 3 fields: Cost, Qty, and Total
Cost = 5.00, Qty = 3, Total = 0 (needs to be updated)
Record format name is MyFiler
The code would look like this..
eval Total = Cost * Qty
update MyFiler
That’s it!!!
Tod
Hi,
Same thing as above in SQL would be :-
UPDATE MyFile SET Total = Cost * Qty
Regards,
Martin Gilbert.