Re: pgsql-function - Mailing list pgsql-sql

From hubert depesz lubaczewski
Subject Re: pgsql-function
Date
Msg-id 20150414112703.GB2224@depesz.com
Whole thread Raw
In response to pgsql-function  (Rishi Ranjan <rishiranjan706@gmail.com>)
Responses Re: pgsql-function  (Rishi Ranjan <rishiranjan706@gmail.com>)
List pgsql-sql
On Tue, Apr 14, 2015 at 03:39:38AM -0700, Rishi Ranjan wrote:
> i have data like below and where ap_key is same for two different
> first_occurence column . here i need to write a function which can
> calculate the difference of two timestamp values for a Ap_Key and then with
> difference it should multiply the severity

1. Why does it have to be a function? Can't it simply be a query?
2. Which pg version do you use?
3. Which severity to use? from the earlier FIRSTOCCURRENCE, or later, or  simply higher/lower SEVERITY?

Basically what you're looking for is most likely some group by with
min/max.

depesz

-- 
The best thing about modern society is how easy it is to avoid contact with it.
                  http://depesz.com/
 



pgsql-sql by date:

Previous
From: Rishi Ranjan
Date:
Subject: pgsql-function
Next
From: Rishi Ranjan
Date:
Subject: Re: pgsql-function