Categories: MSDN / DotNet / Java / Scripts / Linux / PHP Ask - La ask - La Answer

duration average...

Hi,

I would like to compute (with SQL server) some durations average.
Indeed I have a table like this :

name | birthday
------
toto | 01/02/78
titi | 05/04/75

I would like to compute the age of toto and titi. And then to compute the
average of the 2 values.

Does someone know how to do that ?
Thanks, it could help :)

fabien
[399 byte] By [fabien] at [2007-11-9 21:10:06]
# 1 Re: duration average...
Hello Fabien

This would give you a simple average:

Select sum(datediff(year,DateOfBirth,Getdate()))/count(*) From Persons

Change the column and table name to suite your needs...

Add a Where xxx=xxx type of constraint to limit quesry to particular
rowsets.

Ibrahim

"fabien" <fgaiddon@trivium.fr> wrote in message
news:3d85fb3c$1@10.1.10.29...
>
> Hi,
>
> I would like to compute (with SQL server) some durations average.
> Indeed I have a table like this :
>
> name | birthday
> ------
> toto | 01/02/78
> titi | 05/04/75
>
> I would like to compute the age of toto and titi. And then to compute the
> average of the 2 values.
>
> Does someone know how to do that ?
> Thanks, it could help :)
>
> fabien
>
IbrahimMalluf at 2007-11-11 23:52:53 >