How to count the amount of days from a date in the past

maximus1974
maximus1974 used Ask the Experts™
on
I want to show the amount of days a product has been in our possession since received(dbo.WOMAST01B.recdate) to today's date. I want to show this count in a column named "Days Left". Any help will be appreciated.

SELECT     dbo.WOMAST01B.step, dbo.WOMAST01B.wono AS WO, dbo.WOMAST01B.item AS PN, dbo.WOMAST01B.location, dbo.WOMAST01B.dept AS SHOP, 
                      dbo.WOMAST01B.location2 AS [ASSIGNED EMPLOYEE], dbo.WOLABO01B.prempl, dbo.WOLABO01B.time, dbo.WOMAST01B.recdate AS [DAYS LEFT]
FROM         dbo.WOMAST01B LEFT OUTER JOIN
                      dbo.WOLABO01B ON dbo.WOMAST01B.wono = dbo.WOLABO01B.wono
WHERE     (dbo.WOMAST01B.dept = 'AVI')

Open in new window

Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Éric MoreauSenior .Net Consultant
Top Expert 2016
Commented:
Top Expert 2010
Commented:
I'm assuming recdate is a date data type.

SELECT DATEDIFF(dd,dbo.WOMAST01B.recdate, GETDATE()) AS [Days Left]

Open in new window

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial