How to use current date in H2 database SQL query

♀尐吖头ヾ 提交于 2020-01-20 04:28:45

问题


I need something like

select * from tableName where date_column > now()

However, now() doesn't work in H2. Please advise.


回答1:


use CURRENT_TIMESTAMP

select * from tableName where date_column > CURRENT_TIMESTAMP()
  • CURRENT_TIMESTAMP



回答2:


IF you want to compare with present date only then use

select * from tableName where date_column > CURRENT_DATE()

IF you want to compare with present date and time also

select * from tableName where date_column > CURRENT_TIMESTAMP


来源:https://stackoverflow.com/questions/14773729/how-to-use-current-date-in-h2-database-sql-query

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!