Prev: Help with query for consecutive years
Next: Return value from stored procedure that returns a recordset
From: Gert-Jan Strik on 29 May 2010 18:02 Try this: Declare @BirthDate datetime SELECT @BirthDate='19650531' SELECT DateDiff(year,@BirthDate,CURRENT_TIMESTAMP) - CASE WHEN DateAdd(year, DateDiff(year,@BirthDate,CURRENT_TIMESTAMP), @BirthDate) > CURRENT_TIMESTAMP THEN 1 ELSE 0 END -- Gert-Jan qjlee wrote: > > I have a table called member, in which contains memberid and dob. How can I > calculate memberid's age based on DOB > > Thanks, > qjlee
First
|
Prev
|
Pages: 1 2 Prev: Help with query for consecutive years Next: Return value from stored procedure that returns a recordset |