Skip to Content
-1

Filtering query result based on DATE functions

I'm having some difficulty filtering table data based on the month and year of a timestamp column in the table. I know I can do:

SELECT MONTH(CURRENT_UTCTIMESTAMP) AS MY_MONTH FROM MY_TABLE

which returns a column called MY_MONTH with numeric data of the month ordinals but I need to be able to do something like:

SELECT MONTH(CURRENT_UTCTIMESTAMP) AS MY_MONTH FROM MY_TABLE WHERE MY_MONTH=4

...and I can't seem to be able to do this. I'm guessing it's something very simple I'm missing.

Add comment
10|10000 characters needed characters exceeded

  • Get RSS Feed

1 Answer

  • Best Answer
    Apr 25, 2017 at 12:59 AM

    Just figured it out:

    SELECT * FROM MY_TABLE WHERE MONTH(CURRENT_UTCTIMESTAMP) = 4

    Add comment
    10|10000 characters needed characters exceeded