SQL语句判断是否为今天或昨天

Posted

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SQL语句判断是否为今天或昨天相关的知识,希望对你有一定的参考价值。

方法一
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;
 
来源  http://bbs.csdn.net/topics/390972038?page=1

以上是关于SQL语句判断是否为今天或昨天的主要内容,如果未能解决你的问题,请参考以下文章