Re: Substracting Date field from integer value in another field

From: Rene Romero Benavides <rene(dot)romero(dot)b(at)gmail(dot)com>
To: Abdul Hameed <atheequeahmed(at)gmail(dot)com>
Cc: pgsql-sql(at)postgresql(dot)org
Subject: Re: Substracting Date field from integer value in another field
Date: 2017-08-30 12:52:51
Message-ID: CANaGW08VGxsgT5EWdyQU7278BDuEyX8VTG=Z7QFHGWBqFkAe=Q@mail.gmail.com
Views: Raw Message | Whole Thread | Download mbox | Resend email
Thread:
Lists: pgsql-sql

Try this:
SELECT ACS_TIMESTAMP - acct_session_time * '1 second'::interval FROM
RADIUS_ACC_48

2017-08-30 6:20 GMT-05:00 Abdul Hameed <atheequeahmed(at)gmail(dot)com>:

> Getting below error.
>
>
> ERROR: operator does not exist: timestamp with time zone - bigint
>
> LINE 65: ACS_TIMESTAMP-acct_session_time/(24*60*60) ELSE ACS_TIMESTAM..
>
>
>
> I have a table with one column as timestamp (Logon Time), another column
> as integer(seconds).
>
> I would like to deduct the logon time(timestamp) – integer field(seconds)
> to get the final value in TIMESTAMP format.
>
>
> SELECT ACS_TIMESTAMP - acct_session_time FROM RADIUS_ACC_48
>
>
> ERROR: operator does not exist: timestamp with time zone - bigint
>
> LINE 65: ACS_TIMESTAMP-acct_session_time/(24*60*60) ELSE ACS_TIMESTAM..
>
>
> Please let me know the syntax for that.
>

--
El genio es 1% inspiración y 99% transpiración.
Thomas Alva Edison
http://pglearn.blogspot.mx/

In response to

Responses

Browse pgsql-sql by date

  From Date Subject
Next Message Abdul Hameed Kareem -X (abdukare - HCL TECHNOLOGIES LIMITED at Cisco) 2017-08-31 03:48:51 Re: Substracting Date field from integer value in another field
Previous Message Abdul Hameed 2017-08-30 11:20:26 Substracting Date field from integer value in another field