SQL Server Forums
Profile | Register | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 question for sql syntax?
 New Topic  Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Trininole
Yak Posting Veteran

USA
83 Posts

Posted - 12/22/2010 :  14:34:29  Show Profile  Reply with Quote
what is the synatx for subtracting 90 from the last activity date (aed)
for example is it (90-max(aed))?? How would it be written in sql?

Roger DeFour

russell
Pyro-ma-ni-yak

USA
5072 Posts

Posted - 12/22/2010 :  14:50:26  Show Profile  Visit russell's Homepage  Reply with Quote
SELECT DateAdd(day, -90, MAX(aed)) FROM yourTable;
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/22/2010 :  14:56:11  Show Profile  Reply with Quote
dateadd(day,-90,max(aed))
If aed column is a date type (datetime,smalldatetime, date etc.), you could even do the followin
max(aed)-90
I usually prefer the dateadd function.
Go to Top of Page

sunitabeck
Flowing Fount of Yak Knowledge

5155 Posts

Posted - 12/22/2010 :  14:56:50  Show Profile  Reply with Quote
russel beat me to it!!
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.06 seconds. Powered By: Snitz Forums 2000