select * from tableName where to_char(datefield,'hh24:mi') between '10:00' and '15:00' and datefield between '12-2月-05' and '19-3月-05';
每天10:00到15:00的 select * from tableName where to_char(datefield,'hh24:mi') between '10:00' and '15:00' and datefield between '12-2月-05' and '2-3月-05';每天18:00到7:00的 select * from tableName where to_char(datefield,'hh24:mi') not between '7:00' and '18:00' and datefield between '12-2月-05' and '2-3月-05';
第二句应该是这样 select * from tableName where to_char(datefield,'hh24:mi') not between '07:00' and '18:00' and datefield between '12-2月-05' and '2-3月-05';
(1) select * from tableName where to_char(datefield, 'hh24:mi') between '10:00' and '15:00' and datefield between to_date('20050212', 'YYYYMMDD') and to_date('20050301', 'YYYYMMDD'); (2) select * from tableName where to_char(datefield, 'hh24:mi') between '18:00' and '23:59' and datefield between to_date('20050212', 'YYYYMMDD') and to_date('20050301', 'YYYYMMDD'); union select * from tableName where to_char(datefield, 'hh24:mi') between '00:00' and '07:00' and datefield between to_date('20050213', 'YYYYMMDD') and to_date('20050302', 'YYYYMMDD');
select * from table t where to_char(t.出国时间, 'YYYY') between '2000' and '2001'
'YYYY' 这个是啥?在'2000' 和 '2001'的位置,我需要接受使用者的数据。aaa = request("out") bbb = request("in") sql = "select * from Times where Time_out between '"aaa"' and '"bbb"'"怎么没值?
aaa = request("out") bbb = request("in") sql = "select * from Times where to_char(Time_out , 'YYYY') between '"aaa"' and '"bbb"'"
select * from tableName where to_char(datefield,'hh24:mi') between '10:00' and '15:00' and datefield between '12-2月-05' and '2-3月-05';每天18:00到7:00的
select * from tableName where to_char(datefield,'hh24:mi') not between '7:00' and '18:00' and datefield between '12-2月-05' and '2-3月-05';
select * from tableName where to_char(datefield,'hh24:mi') not between '07:00' and '18:00' and datefield between '12-2月-05' and '2-3月-05';
select *
from tableName
where to_char(datefield, 'hh24:mi') between '10:00' and '15:00'
and datefield between to_date('20050212', 'YYYYMMDD') and
to_date('20050301', 'YYYYMMDD');
(2)
select *
from tableName
where to_char(datefield, 'hh24:mi') between '18:00' and '23:59'
and datefield between to_date('20050212', 'YYYYMMDD') and
to_date('20050301', 'YYYYMMDD');
union
select *
from tableName
where to_char(datefield, 'hh24:mi') between '00:00' and '07:00'
and datefield between to_date('20050213', 'YYYYMMDD') and
to_date('20050302', 'YYYYMMDD');
回国时间: 2000-11-41)出国时间: 2000-4-1
回国时间: 2000-12-41)出国时间: 2000-5-1
回国时间: 2001-3-4我想查询在2000年到2001年出国的数据,用between可以吗?(以出国时间为准,这3条数据都应该被查询出来)请问这样的SQL如何些?先谢谢前辈们了!
from table t
where to_char(t.出国时间, 'YYYY') between '2000' and '2001'
bbb = request("in")
sql = "select * from Times where Time_out between '"aaa"' and '"bbb"'"怎么没值?
bbb = request("in")
sql = "select * from Times
where to_char(Time_out , 'YYYY') between '"aaa"' and '"bbb"'"