Oracle中如何查询带日期的查询语句

select MOBILE from local_member where ( (FIRSTLOGINTIME between to_date(2010-2-1 00:00:00,'yyyy-mm-dd') and to_date(2010-2-28 23:59:59,'yyyy-mm-dd')) and ( lASTLOGINTIME between to_date(2010-2-1 00:00:00,'yyyy-mm-dd') and to_date(2010-2-28 23:59:59,'yyyy-mm-dd')))
最新回答
吹梦到西洲

2024-10-11 08:44:55

简单号,ROACEL里查询日期带时间的是
to_date('20100201 00:00:00','YYYYMMDD hh24:mi:ss')这样的。
你的语句可以改成

select MOBILE
from local_member
where ( (FIRSTLOGINTIME between to_date('20100201 00:00:00','yyyymmdd hh24:mi:ss') and to_date('20100228 23:59:59','yyyymmdd hh24:mi:ss')) and ( lASTLOGINTIME between to_date('20100201 00:00:00','yyyymmdd hh24:mi:ss') and to_date('20100228 23:59:59','yyyymmdd hh24:mi:ss')))
裴裟曼依人

2024-10-11 10:33:41

select MOBILE
from local_member
where ( (FIRSTLOGINTIME between to_date('2010-2-1 00:00:00','yyyy-mm-dd hh24:miss') and to_date('2010-2-28 23:59:59','yyyy-mm-dd hh24:mi:ss')) and ( lASTLOGINTIME between to_date('2010-2-1 00:00:00','yyyy-mm-dd hh24:mi:ss') and to_date('2010-2-28 23:59:59','yyyy-mm-dd hh24:mi:ss')))
永不言弃

2024-10-11 09:15:48

select MOBILE
from local_membe
where FIRSTLOGINTIME between to_date('1980-06-04','yyyy-mm-dd') and to_date('1987-07-09','yyyy-mm-dd');
如果要加时分秒应该 to_date('2010-2-28 23:59:59','yyyy-mm-dd hh24:mi:ss')
天神风之恋

2024-10-11 10:44:02

将所有'yyyy-mm-dd'替换成'yyyy-mm-dd hh24:mi:ss'