Home All Groups Group Topic Archive Search About
Author
2 Sep 2005 5:51 PM
wnfisba
I have to calculate the average age in a group.

What is the best way to calculate the average age where I have the
individual's birth date???

Thanks in advance!

Author
2 Sep 2005 5:56 PM
Perayu
I would use
select datediff(mm, yourDOB, getdate())/12.0

Perayu


Show quote
"wnfisba" <wnfi***@discussions.microsoft.com> wrote in message
news:F3FCEC3B-D90D-42C5-B42D-179206660285@microsoft.com...
>I have to calculate the average age in a group.
>
> What is the best way to calculate the average age where I have the
> individual's birth date???
>
> Thanks in advance!
Author
2 Sep 2005 5:56 PM
David Portas
SELECT AVG(DATEDIFF(DAY,birth_date,CURRENT_TIMESTAMP))/365.25
FROM YourTable
GROUP BY ...

--
David Portas
SQL Server MVP
--
Author
2 Sep 2005 5:57 PM
David Gugick
wnfisba wrote:
> I have to calculate the average age in a group.
>
> What is the best way to calculate the average age where I have the
> individual's birth date???
>
> Thanks in advance!

More information please...

Post your table DDL and more detailed specs of what you're trying to
accomplish. SQL has an AVG() function to calculate averages based on a
set of data.


--
David Gugick
Quest Software
www.imceda.com
www.quest.com
Author
3 Sep 2005 8:18 PM
Paul Pedersen
As an alternative to getting the average age, you could get the average
birthdate. That could be more useful in some circumstances.


Show quote
"wnfisba" <wnfi***@discussions.microsoft.com> wrote in message
news:F3FCEC3B-D90D-42C5-B42D-179206660285@microsoft.com...
>I have to calculate the average age in a group.
>
> What is the best way to calculate the average age where I have the
> individual's birth date???
>
> Thanks in advance!
Author
3 Sep 2005 10:11 PM
Steve Kass
Just be sure it's birthdate, not birth(month/day).  I can see the headline:
"Average American born in early July, study shows." ;)

Steve Kass
Drew University

Paul Pedersen wrote:

Show quote
>As an alternative to getting the average age, you could get the average
>birthdate. That could be more useful in some circumstances.
>
>
>"wnfisba" <wnfi***@discussions.microsoft.com> wrote in message
>news:F3FCEC3B-D90D-42C5-B42D-179206660285@microsoft.com...

>
>>I have to calculate the average age in a group.
>>
>>What is the best way to calculate the average age where I have the
>>individual's birth date???
>>
>>Thanks in advance!
>>   
>>
>
>

>
Author
6 Sep 2005 12:14 AM
Paul Pedersen
Ha ha! So I'm average after all.


Show quote
"Steve Kass" <sk***@drew.edu> wrote in message
news:OcEysRNsFHA.1252@TK2MSFTNGP09.phx.gbl...
> Just be sure it's birthdate, not birth(month/day).  I can see the
> headline:
> "Average American born in early July, study shows." ;)
>
> Steve Kass
> Drew University
>
> Paul Pedersen wrote:
>
>>As an alternative to getting the average age, you could get the average
>>birthdate. That could be more useful in some circumstances.
>>
>>
>>"wnfisba" <wnfi***@discussions.microsoft.com> wrote in message
>>news:F3FCEC3B-D90D-42C5-B42D-179206660285@microsoft.com...
>>
>>>I have to calculate the average age in a group.
>>>
>>>What is the best way to calculate the average age where I have the
>>>individual's birth date???
>>>
>>>Thanks in advance!
>>
>>
>>

AddThis Social Bookmark Button