Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 question for sql syntax?

Author  Topic 

Trininole
Yak Posting Veteran

83 Posts

Posted - 2010-12-22 : 14:34:29
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

5072 Posts

Posted - 2010-12-22 : 14:50:26
SELECT DateAdd(day, -90, MAX(aed)) FROM yourTable;
Go to Top of Page

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

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

sunitabeck
Master Smack Fu Yak Hacker

5155 Posts

Posted - 2010-12-22 : 14:56:50
russel beat me to it!!
Go to Top of Page
   

- Advertisement -