PostgreSQL: Select data with a like on timestamp field

后端 未结 5 1163
隐瞒了意图╮
隐瞒了意图╮ 2020-12-23 16:29

I am trying to select data from a table, using a \"like\" on date field \"date_checked\" (timestamp). But I have this error :

SQLSTATE[42883]: Undefined func         


        
5条回答
  •  余生分开走
    2020-12-23 17:14

    Perhaps the date_trunc function would be more to your liking:

    ... WHERE date_trunc('month', my_table.date_checker) = '2011-01-01'
    

    You can also put an index on that expression, if needed.

提交回复
热议问题