select * from AAA where trunc(a) = trunc(sysdate);
select * from AAA where trunc(a) = trunc(sysdate)-1;
#2
还有别的写法吗,你这个用了好慢好慢
#3
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
#4
3楼的写法,然后表上对时间列建立索引,查询速度应该不慢
#5
++
#6
select * from AAA where a between sysdate-1 and sysdate
#7
select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate,'yyyymmdd');
select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate-1,'yyyymmdd');
不用客气!
#8
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
#9
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
#10
3楼的写法是唯一最优、最准确的写法。
#11
++
#12
可以使用系统时间和数据库中存放的时间段进行比较,判断是今天还是昨天
#13
3L和1L的写法区别在于什么,为什么第二种要更好呢
#14
第一种trunc(a)不能使用索引,第二种可以使用索引
#1
select * from AAA where trunc(a) = trunc(sysdate);
select * from AAA where trunc(a) = trunc(sysdate)-1;
#2
select * from AAA where trunc(a) = trunc(sysdate);
select * from AAA where trunc(a) = trunc(sysdate)-1;
还有别的写法吗,你这个用了好慢好慢
#3
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
#4
3楼的写法,然后表上对时间列建立索引,查询速度应该不慢
#5
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
++
#6
select * from AAA where a between sysdate-1 and sysdate
#7
select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate,'yyyymmdd');
select * from AAA where to_char(a,'yyyymmdd') = to_char(sysdate-1,'yyyymmdd');
不用客气!
#8
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
#9
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate,'YYYYMMDD');
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
#10
3楼的写法是唯一最优、最准确的写法。
#11
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
++
#12
可以使用系统时间和数据库中存放的时间段进行比较,判断是今天还是昨天
#13
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
3L和1L的写法区别在于什么,为什么第二种要更好呢
#14
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);