From: | "Oscar Cano" <oscarcanorodriguez(at)gmail(dot)com> |
---|---|
To: | Espartano <espartano(dot)mail(at)gmail(dot)com> |
Cc: | pgsql-es-ayuda(at)postgresql(dot)org |
Subject: | Re: Edad en años |
Date: | 2007-12-23 13:36:27 |
Message-ID: | edacf7a30712230536s165d9a58p9e0b0ca0dff59d43@mail.gmail.com |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | pgsql-es-ayuda |
Pero date_part o extrac, me dan la parte de una fecha, ¿como puedo calcular
la edad en años cumplidos?
2007/12/22, Espartano <espartano(dot)mail(at)gmail(dot)com>:
>
> 2007/12/22, Oscar Cano <oscarcanorodriguez(at)gmail(dot)com>:
> > Tengo una tabla con un campo "f_nace" de tipo date, que tiene la fecha
> de
> > nacimiento quiero la edad en años
> >
> > Utilizando:
> > SELECT age(f_nace) as edad FROM candidato WHERE id=119
> >
> > Me arroja
> > "38 years 3 mons 29 days"
> >
> > como puedo hacer para que solo me regrese 38, es decir quiero saber
> > únicamente la edad en años cumplidos
> >
> > ¿Alguna idea?
>
> Utiliza la funcion date_part o extract :p
>
> --
> "Linux is for people who hate Windows, BSD is for people who love UNIX".
> "Social Engineer -> Because there is no patch for human stupidity"
> "The Unix Guru's View of Sex unzip ; strip ; touch ; grep ; finger ;
> mount ; fsck ; more ; yes ; umount ; sleep."
> "Documentation is like sex: when it is good, it is very, very good;
> and when it is bad, it is better than nothing."
>
--
Oscar Cano Rodríguez
PLD Consultores
From | Date | Subject | |
---|---|---|---|
Next Message | Espartano | 2007-12-23 18:47:41 | Re: Edad en años |
Previous Message | Fernando Miranda | 2007-12-23 13:21:02 | Codifiacion Base de Datos |