pg.ddx.io  pgsql-sql@postgresql.org mailing list archive  
help / color / mirror / Atom feed
Substracting Date field from integer value in another field
3+ messages / 3 participants
[nested] [flat]

* Substracting Date field from integer value in another field
@ 2017-08-30 11:20  Abdul Hameed <atheequeahmed@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Abdul Hameed @ 2017-08-30 11:20 UTC (permalink / raw)
  To: pgsql-sql

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.

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Substracting Date field from integer value in another field
@ 2017-08-30 12:52  Rene Romero Benavides <rene.romero.b@gmail.com>
  parent: Abdul Hameed <atheequeahmed@gmail.com>
  0 siblings, 1 reply; 3+ messages in thread

From: Rene Romero Benavides @ 2017-08-30 12:52 UTC (permalink / raw)
  To: Abdul Hameed <atheequeahmed@gmail.com>; +Cc: 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@gmail.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/

^ permalink  raw  reply  [nested|flat] 3+ messages in thread

* Re: Substracting Date field from integer value in another field
@ 2017-08-31 03:48  Abdul Hameed Kareem -X (abdukare - HCL TECHNOLOGIES LIMITED at Cisco) <abdukare@cisco.com>
  parent: Rene Romero Benavides <rene.romero.b@gmail.com>
  0 siblings, 0 replies; 3+ messages in thread

From: Abdul Hameed Kareem -X (abdukare - HCL TECHNOLOGIES LIMITED at Cisco) @ 2017-08-31 03:48 UTC (permalink / raw)
  To: Rene Romero Benavides <rene.romero.b@gmail.com>; Abdul Hameed <atheequeahmed@gmail.com>; +Cc: pgsql-sql

Hi Rene,

That works. Thanks for your prompt reply.

Thanks
Abdul Hameed

[https://www.cisco.com/c/dam/m/en_us/signaturetool/images/logo/Cisco_Logo_no_TM_Indigo_Blue-RGB_43px....]




Abdul Hameed Kareem
Technical Lead
abdukare@cisco.com<mailto:abdukare@cisco.com>
Tel:










Cisco Systems, Inc.



India
cisco.com



[http://www.cisco.com/assets/swa/img/thinkbeforeyouprint.gif]

Think before you print.

This email may contain confidential and privileged material for the sole use of the intended recipient. Any review, use, distribution or disclosure by others is strictly prohibited. If you are not the intended recipient (or authorized to receive for the recipient), please contact the sender by reply email and delete all copies of this message.
Please click here<http://www.cisco.com/c/en/us/about/legal/terms-sale-software-license-agreement/company-registration-...; for Company Registration Information.







From: pgsql-sql-owner@postgresql.org [mailto:pgsql-sql-owner@postgresql.org] On Behalf Of Rene Romero Benavides
Sent: 30 August 2017 18:23
To: Abdul Hameed <atheequeahmed@gmail.com>
Cc: pgsql-sql@postgresql.org
Subject: Re: [SQL] Substracting Date field from integer value in another field

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@gmail.com<mailto:atheequeahmed@gmail.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/



Attachments:

  [image/png] image001.png (55.9K, ../../009fd56dd0444302a30dfb0a3218866a@XCH-RCD-015.cisco.com/3-image001.png)
  download | view image

  [image/gif] image002.gif (134B, ../../009fd56dd0444302a30dfb0a3218866a@XCH-RCD-015.cisco.com/4-image002.gif)
  download | view image

^ permalink  raw  reply  [nested|flat] 3+ messages in thread


end of thread, other threads:[~2017-08-31 03:48 UTC | newest]

Thread overview: 3+ messages (download: mbox mbox.gz follow: Atom feed)
-- links below jump to the message on this page --
2017-08-30 11:20 Substracting Date field from integer value in another field Abdul Hameed <atheequeahmed@gmail.com>
2017-08-30 12:52 ` Rene Romero Benavides <rene.romero.b@gmail.com>
2017-08-31 03:48   ` Abdul Hameed Kareem -X (abdukare - HCL TECHNOLOGIES LIMITED at Cisco) <abdukare@cisco.com>

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