Creating a simple recurring Chores database.
ChoreName
EveryNDays 'This is greater than zero if the chore rule applies
EveryNWeeks 'This is 0 if EveryNDays is greater than 0
'...
'Someothers
'...
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
Same result.
Any thoughts?
*** 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.