WHERE Clause to find all records in a specific month

后端 未结 10 2126
傲寒
傲寒 2020-12-04 10:07

I want to be able to give a stored procedure a Month and Year and have it return everything that happens in that month, how do I do this as I can\'t compare between as some

10条回答
  •  情深已故
    2020-12-04 10:43

    More one tip very simple. You also could use to_char function, look:

    For Month:

    to_char(happened_at , 'MM') = 01

    For Year:
    to_char(happened_at , 'YYYY') = 2009

    For Day:

    to_char(happened_at , 'DD') = 01

    to_char funcion is suported by sql language and not by one specific database.

    I hope help anybody more...

    Abs!

提交回复
热议问题