From: Octavio Alvarez <alvarezp@tecbc.mx>
To: pgsql-sql@postgresql.org
Date: Fri, 18 Mar 2005 09:57:25 -0800
Message-ID: <opsnuhhzgwg6g4in@octavio.tecbc.mx> (raw)
Sorry, I tried to make my subject as good as possible.
I have a table where I store the dates in which I take out of my inventory
(like "installation dates")
table
---------------
row_id SERIAL
date DATE
fk_item INTEGER
and that's pretty much it.
I want to have a query returning how long have been certain items lasting.
Say I have:
SELCT date FROM table WHERE fk_item = "INKJET_INK-BW"
date
-------------
2005-02-02
2005-03-05
2005-04-07
2005-05-02
I need something to calculate the intervals between those dates, like this:
intervals (in days)
--------------------
31
34
25
So I can get the stddev and stuff from the "duration" of the items.
I've been having a hard time with it. I'm trying NOT to program new
functions.
Any help will be appreciated.
--Octavio
--
Ing. Octavio Alvarez Piza, Jefe de Informática, TBC Universidad.
Tel.: +52 (664) 621-7111 ext. 133; E-mail: alvarezp@tecbc.net
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: pgsql-sql@postgresql.org
Cc: alvarezp@tecbc.mx
Subject: Re:
In-Reply-To: <opsnuhhzgwg6g4in@octavio.tecbc.mx>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by DDX for PostgreSQL; see mirroring instructions
for how to clone and mirror all data and code used for this inbox