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)
 DATE ADD FUNCTION QUESTION

Author  Topic 

yardy78
Starting Member

3 Posts

Posted - 2014-10-30 : 22:28:06


date function that gets the max date of a field named created date plus 8 years ERROR

example
select firname, lastname, count(accountid), max(created_date)
from employess
where created_date > dateadd(year,8,created_date)
group by firname, lasstname,
having count > 1

khtan
In (Som, Ni, Yak)

17689 Posts

Posted - 2014-10-31 : 00:00:49
[code]select firname, lastname, count(accountid), DATEADD(YEAR, 8, max(created_date))
from employess
where created_date > dateadd(year,8,created_date)
group by firname, lasstname,
having count(accountid) > 1
[/code]


KH
[spoiler]Time is always against us[/spoiler]

Go to Top of Page
   

- Advertisement -