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
 SQL Server 2012 Forums
 Transact-SQL (2012)
 Max dater greater than 3 years

Author  Topic 

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-11-03 : 16:05:23
Get max date of a column that is greater than 3 years

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2014-11-03 : 16:10:19
select max(datecol) from yourtable where datecol > dateadd(yy,-3,getdate())

Tara Kizer
SQL Server MVP since 2007
http://weblogs.sqlteam.com/tarad/
Go to Top of Page

Blessed1978
Yak Posting Veteran

97 Posts

Posted - 2014-11-04 : 10:16:24
I want to find the max date then show all transaction that have a date that is 3 years greater the max date. Not getdate()

Example

Select distinct employee Id,count email, max transdate From employee
Where transdate > dateadd year ,3, transdate
Group by
Having count
Go to Top of Page
   

- Advertisement -