数据库日期类型转换–HSQL
数据库日期类型转换–HSQL
最近遇到要用HSQL查询离某个时间的后十分钟的记录,不像Oracle和SqlServer中可以直接有函数转换,而是直接通过'+'来得到
Hsql Document -- standard forms CURRENT_DATE + '2' DAY SELECT (LOCALTIMESTAMP - atimestampcolumn) DAY TO SECOND FROM atable -- non-standard forms CURRENT_DATE + 2 SELECT LOCALTIMESTAMP - atimestampcolumn FROM atable example: select top 1 created_on+'10' minute from table; 注:created_on是表里的某个字段,类型是timestamp类型 select * from table where created_on >= created_on+'1' minute and status='Active'; 查询创建时间后十分钟且状态在线的记录 select created_on+'1' DAY from table;