Re: Edad en años

From: Espartano <espartano(dot)mail(at)gmail(dot)com>
To: "Oscar Cano" <oscarcanorodriguez(at)gmail(dot)com>
Cc: pgsql-es-ayuda(at)postgresql(dot)org
Subject: Re: Edad en años
Date: 2007-12-22 20:37:29
Message-ID: d353bd50712221237i39d7141an6eaabe4a7dc14e53@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

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."

In response to

Responses

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message Marco Vinicio Jimenez Rojas 2007-12-23 02:24:31 problemas con conexion remota
Previous Message Oscar Cano 2007-12-22 15:55:23 Edad en años