1

I have over 50K people in my system with their DOB under a tablename as Employee and column_name as Birthdate. i have report to generete to find how many people did actually turned 65 until todays date,and somebody turning 65 in future months ( AUGUST, SEP, OCT and so on). can somebody please help me how would i write that query ?

user255826
  • 41
  • 8
  • select * from employee where birthdate = 'sysdate - 23725' for somebody who are already turned as 65 – user255826 Jul 15 '14 at 22:42
  • 23725 basically was for (65X365 days) so somebody who has turned 65 , but couldnt find the way to solve the future dated .. – user255826 Jul 15 '14 at 22:46

1 Answers1

0

I'm not a sybase expert, but this should return all employees who are over 65 years as at 01 July 2014

select * from employee
where datediff(yy, Birthdate, "Jul 1, 2014") > 65

Source: http://infocenter.sybase.com/help/index.jsp?topic=/com.sybase.infocenter.dc36271.1550/html/blocks/X47295.htm (Google searched for sybase sql datediff)

John
  • 5,672
  • 7
  • 34
  • 52