How can I add minutes using dateadd()
with a query result ?
Like this:
SELECT dateadd(minute, (SELECT
isnull(time1 - time2, 0)
FROM table
WHERE field = 111) , getdate())
In this case, the select result is 288
but it don't add
I need ADD this 288 in the function
Like this:
SELECT dateadd(minute, 288, getdate())
SELECT DATEADD(MINUTE, DATEDIFF(MINUTE, time1, time2), GETDATE())
FROM table
WHERE field = 111
This will add difference in minutes between time1 and time2 to current date, if that's what you want to achieve.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With