Re: Restar dos campos de tipo fecha de distintos registros

From: Alvaro Herrera <alvherre(at)2ndquadrant(dot)com>
To: Hellmuth Vargas <hivs77(at)gmail(dot)com>
Cc: Alberto Cuevas <betocuevas(dot)net(at)gmail(dot)com>, Gerardo Herzig <gherzig(at)fmed(dot)uba(dot)ar>, Lista Postgres ES <pgsql-es-ayuda(at)postgresql(dot)org>
Subject: Re: Restar dos campos de tipo fecha de distintos registros
Date: 2016-04-18 21:07:37
Message-ID: 20160418210737.GA645588@alvherre.pgsql
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-es-ayuda

Hellmuth Vargas escribió:

> Hola lista
>
> Con Window Functions (
> http://www.postgresql.org/docs/9.4/static/tutorial-window.html) puede
> realizar eso...para el problema especifico seria asi:
>
> SELECT *,
> LAG(FechaInicial) over(order by Ord),FechaFinal-LAG(FechaInicial)
> over(order by Ord) as diferencia

Eso mismo opino, gracias por construir el ejemplo completo.

--
Álvaro Herrera http://www.2ndQuadrant.com/
PostgreSQL Development, 24x7 Support, Remote DBA, Training & Services

-
Enviado a la lista de correo pgsql-es-ayuda (pgsql-es-ayuda(at)postgresql(dot)org)
Para cambiar tu suscripción:
http://www.postgresql.org/mailpref/pgsql-es-ayuda

In response to

Browse pgsql-es-ayuda by date

  From Date Subject
Next Message mauricio pullabuestan 2016-04-19 02:32:54 Re: Restar dos campos de tipo fecha de distintos registros
Previous Message Hellmuth Vargas 2016-04-18 21:03:11 Re: Restar dos campos de tipo fecha de distintos registros