注册 登录
编程论坛 PowerBuilder

怎样查询datetime字段里的数据

长青藤 发布于 2006-05-07 23:10, 888 次点击

我用的是Oracle数据库,现要在PB里用ISQL查询表salehead中的数据,以表salehead中的saledate字段(数据类型是datetime)为条件查询销售数据,应如何做。

我试了以下几种方法都不行,我的目的是查询5月1日上午9点至10点的销售。

其一:

select * from salehead

where saledate>='2006-5-1 09:00:00' and saledate<='2006-5-1- 09:59:59';

其二:

select * from salehead

where saledate between 2006-5-1 09:00:00 and 2006-5-1 09:5959;

6 回复
#2
hsjljh2006-05-08 21:00

hehe look help

#3
mlqiang2006-05-09 07:32
使用trunc()
#4
长青藤2006-05-13 20:54
请问如何具体实现
#5
wsl0002006-05-14 09:47
    where saledate&gt;=datetime('2006-5-1 09:00:00') and saledate&lt;=datetime('2006-5-1- 09:59:59');
#6
长青藤2006-05-14 21:06

楼上,用你的这个方法也不行。

#7
q1231262006-05-19 17:35
select *
from my_入库单历史记录
where rukushijian>='2006-5-11 14:00:00' and rukushijian<='2006-5-11 15:00:00';
我这样是可以的,刚试过
1