Page 1 of 1
Update columns in database
Posted: Wed May 07, 2014 9:06 pm
by Bil_James
How can I update columns of some registered users (for example all users who's favorite color is blue get 10 points) in the database? In SQL I would use an UPDATE statement (UPDATE users SET user_points = 10 WHERE favorite_color = blue)
Update columns in database
Posted: Thu May 08, 2014 1:22 am
by Igor
Update columns in database
Posted: Thu May 08, 2014 5:31 pm
by Bil_James
Thanks for your quick reply! Basically I want to update points of users who answered a question correctly.
1.But I cannot update columns of several rows with a 'where' parameter (for example all users who's favorite color is blue get 10 points).
- What default value do I have to type in the Database Service if I want to increase the number of a column? When I type in +25 it sets the number to 25 instead of increasing it by 25.
- And how can I import the Users collection service? I can only import custom collection services.
Update columns in database
Posted: Thu May 08, 2014 9:24 pm
by Kateryna Grynko
Hi Bil,
You can update objects only one by one: http://docs.appery.io/documentation/b...
You can't import collection 'Users' - just paste records one by one.
Update columns in database
Posted: Thu May 08, 2014 9:30 pm
by Bil_James
Why is that? So is there any other way how I coud create a highscore and update the points of every user who answered correctly? I can't update by one if there are for example 100 users who answered correctly and 100 who didn't.
Update columns in database
Posted: Fri May 09, 2014 7:45 am
by Serhii Kulibaba
You can do it just one by one. E.g. read list of users and call update service for each one.