select * from AAA where trunc(a) = trunc(sysdate); select * from AAA where trunc(a) = trunc(sysdate)-1;
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1; select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
select * from AAA where a between sysdate-1 and sysdate
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');不用客气!
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');
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');
select * from AAA where trunc(a) = trunc(sysdate);
select * from AAA where trunc(a) = trunc(sysdate)-1;
select * from AAA where a>=trunc(sysdate) and a< trunc(sysdate)+1;
select * from AAA where a>= trunc(sysdate)-1 and a<trunc(sysdate);
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');不用客气!
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
select * from AAA where to_char(a,'YYYYMMDD') = to_char(sysdate-1,'YYYYMMDD');
第一种trunc(a)不能使用索引,第二种可以使用索引