Update records in a table in a process

If you think that something doesn't work in Aware IM post your message here
Post Reply
jannes
Posts: 100
Joined: Tue Jul 02, 2019 12:22 pm

Update records in a table in a process

Post by jannes »

Table with 2 fields :
Name : Plain text
Period : Number

I want to update (increase) field “period” by 1
In SQL : UPDATE person SET period = period + 1 WHERE period > 2017

I expect :
FIND Persoon WHERE Persoon.Period > 2017
Persoon.Period=Persoon.Period + 1

But this doesn’t work properly, all selected records are updated to the same value.

So I used an extra : IN BATCHES OF 1
FIND Persoon WHERE Persoon.Periode > 2017 IN BATCHES OF 1
Persoon.Periode=Persoon.Periode + 1

It worked but I guess it will be very slow when there are many records.
Jaymer
Posts: 2430
Joined: Tue Jan 13, 2015 10:58 am
Location: Tampa, FL
Contact:

Re: Update records in a table in a process

Post by Jaymer »

Click Here to see a collection of my tips & hacks on this forum. Or search for "JaymerTip" in the search bar at the top.

Jaymer
Aware Programming & Consulting - Tampa FL
customaware
Posts: 2391
Joined: Mon Jul 02, 2012 12:24 am
Location: Ulaanbaatar, Mongolia

Re: Update records in a table in a process

Post by customaware »

Have sent you a sample bsv on Skype Jannes
Cheers,
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....
Image
Post Reply