pgsql-function

From: Rishi Ranjan <rishiranjan706(at)gmail(dot)com>
To: pgsql-sql(at)postgresql(dot)org
Subject: pgsql-function
Date: 2015-04-14 10:39:38
Message-ID: CALiz8WShL07OjnZySwvmdpYcwDi57JX_WxGSKt69k9kPxLDb8g@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

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

like for 418 time difference is (3/4/2014 0:00 - 3/4/2014/0.05) and it
should get multiplied with severity 5 . in this way we need to calculate
for every ap_key and store the result in separate table.
AAA_key AP_KEY FIRSTOCCURRENCE SEVERITY 111 418 3/4/2014 0:00 5 111
418 3/4/2014 0:05 0 112 12 3/4/2014 0:40 4 112 12 3/4/2014 0:45 0
113 13 3/4/2014
1:05 3 113 13 3/4/2014 1:10 0 114 114 3/4/2014 1:30 2 114 114 3/4/2014
1:35 0 115 35 3/4/2014 2:10 1 115 35 3/4/2014 2:15 0 116 116 3/4/2014
10:14 4 116 116 3/4/2014 10:19 0 117 127 3/4/2014 11:45 3 117 127 3/4/2014
11:49 0 118 118 3/4/2014 12:10 2 118 118 3/4/2014 12:14 0 119 19 3/4/2014
12:35 1 119 19 3/4/2014 12:39 0 119 120 3/4/2014 0:00 4 119 120 3/4/2014
1:40 0

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message hubert depesz lubaczewski 2015-04-14 11:27:03 Re: pgsql-function
Previous Message Adrian Klaver 2015-04-07 21:57:02 Re: Setting the Field Separator in PSQL