Just a guess, but in the datediff you are just extracting the year. If you want to include the month in the calculation, you should probably get the month part too.
Margaret -----Original Message----- From: Dina Hess [mailto:[EMAIL PROTECTED]] Sent: Monday, May 06, 2002 11:20 AM To: CF-Talk Subject: OT: transact-sql datediff function hi all, i posted this on the sql list but got no response. i have a test table named employees with the following fields: fname varchar lname varchar hire_date datetime the record i'm querying contains 2001-05-11 00:00:00.000 in the hire_date field. but this query returns 1 rather than the expected 0: select datediff(yy, hire_date, getdate()) as yearsdiff from employees where fname = 'ann' this should give me the number of years between 5/11/2001 and today's date of 5/6/2002, which should be 0 since it's not 5/11 yet. so why am i getting 1??? ~ dina ______________________________________________________________________ Your ad could be here. Monies from ads go to support these lists and provide more resources for the community. http://www.fusionauthority.com/ads.cfm FAQ: http://www.thenetprofits.co.uk/coldfusion/faq Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/ Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists