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.
Update records in a table in a process
Re: Update records in a table in a process
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
Jaymer
Aware Programming & Consulting - Tampa FL
-
- Posts: 2413
- Joined: Mon Jul 02, 2012 12:24 am
- Location: Ulaanbaatar, Mongolia
Re: Update records in a table in a process
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....
Mark
_________________
AwareIM 6.0, 8.7, 8.8, 9.0 , MariaDB, Windows 10, Ubuntu Linux. Theme: Default, Browser: Arc
Upcloud, Obsidian....