Creating a simple recurring Chores database.
EveryNDays 'This is greater than zero if the chore rule applies
EveryNWeeks 'This is 0 if EveryNDays is greater than 0
StartOn 'Date to start
When querying what chores to do for today, out of all the chores that should be done every N days.
I started by:
SELECT ChoreName FROM Chores
WHERE (EveryNDays <> 0) AND
(Now() - StartOn) Mod EveryNDays) = 0
Resulted in Division By zero.
Reading up on (the lack of) operator shortcircuiting in SQL, I changed to:
SELECT ChoreName FROM
(SELECT * FROM Chores WHERE EveryNDays <> 0) AS T2
WHERE (Now() - StartOn) Mod EveryNDays) = 0
*** Edit. I'll add that I'm actually using DateDiff to get the number of days between StartOn and Now, for the sake of clarity, those are omitted.