I have db table called subscription and a column called duration. I want the column duration to be incremented by +1 in every 24 hours until it gets to 30 then stop. I would love the query to start execution if the column duration is = 1.
David_133
0
Newbie Poster
Recommended Answers
Jump to PostI think you're approaching this from the wrong direction. You should be storing the start date and calculating the increment using
datediff
in a computed column.If you need more complicated logic (like zero days being displayed as one day), take care of that in the application and just store …
Jump to PostI'm assuming that
>30
means expired so why not just do acase
in the query that returns a value forExpired
(or unexpired) ofTrue
orFalse
. That way if the subscription period changes, all that would need to be modified is a stored query. For that matter, instead …
All 5 Replies
pty
882
Posting Pro
rproffitt
2,565
"Nothing to see here."
Moderator
Reverend Jim
4,678
Hi, I'm Jim, one of DaniWeb's moderators.
Moderator
Featured Poster
David_133
commented:
Can I have an example as illustration of what you just said ?
+0
overwraith
83
Newbie Poster
prof php
0
Newbie Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.