David Bensoussan
David Bensoussan

Reputation: 3205

How to use timestamp in AWS Timestream

I have a table with a time field and I am trying to select between 2 timestamps which are in the format:

"2020-10-10 09:00:00.000000000"

I have tried some functions listed here but without success.

Edit: The data is there, as seen in the picture. But the example shows using 7 days ago instead of passing a timestamp.

enter image description here

Upvotes: 4

Views: 6512

Answers (1)

MaFF
MaFF

Reputation: 10086

You can put the key word TIMESTAMP before the string representation of the timestamp to declare a timestamp type:

SELECT TIMESTAMP '2020-10-10 09:00:00'

To filter using an interval you can use keyword BETWEEN or any comparison operator:

SELECT 
    *
FROM my_database.my_table
WHERE
    time BETWEEN TIMESTAMP '2020-10-10 09:00:00' AND TIMESTAMP '2020-10-10 11:00:00'

Upvotes: 8

Related Questions