sql server 2008 - How to subtract today's date (current date) from delivery date SQL Query? -
i have table has current date , delivery date. want minus due date current date , want save days left in dbtable
select clientid, curentdate, deliverydate datediff(day,-(deliverydate) current_timestamp) days_left dbo.tblorder
e.g:
- today date
12/1/2014
- delivery date
20/1/2014
- days left
8
did in the documentation examples on how use datediff
?
select clientid, currentdate, deliverydate, days_left = datediff(day, current_timestamp, deliverydate) dbo.tblorder;
Comments
Post a Comment