Reputation: 3205
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.
Upvotes: 4
Views: 6512
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