日期:2014-05-18  浏览次数:20709 次

如何根据时间来查询,给个具体点的例子吧
最好来一段hql代码的例子,当然别的也行,不过得写清楚。谢了!

------解决方案--------------------
按时间查询?
select *
from bxs.v_bxs_pol_mst t
where t.create_date > = '20060101 ' and
t.create_date <= '20061231 '
------解决方案--------------------
hql 映射的是哪种数据库
mssql 的话,

from tablename t where t.c_date between '1900-01-01 ' and '1999-01-01 '

oracle 的话
from tablename t where t.c_date between to_date( 'yyyy-mm-dd hh24:mi:ss ',
'1900-01-01 12:12:!2 ') and to_date( 'yyyy-mm-dd hh24:mi:ss ', '1999-01-01 12:12:!2 ')