-3

I have a Database that has a row that needs to increase by 1 every 24 hours. I enter "19" that first day. Either at midnight or 24 hours Later I would like that value to Change to "20". Is there a way to do that?

Your help would be Appreciated. Thanks

BAlvernaz
  • 27
  • 3
  • 7

2 Answers2

1

You can create a trigger in SQLite or you can have AlarmManager in JAVA.
For trigger you can visit SQLite trigger
For AlarmManager you can visit Alarm Manager Example

Community
  • 1
  • 1
Krrishnaaaa
  • 689
  • 11
  • 23
1

There are no computed columns in SQLite, and on the Android platform you can't rely on a background process. But all you have to do is add a date column "created" along with your value. Each time you query, add the day difference between now and "created" to the original column to get the value you need.

SELECT [myval] + julianday(Date('now')) - julianday([created])) FROM mytable
McGarnagle
  • 101,349
  • 31
  • 229
  • 260