oracle通过between and 处理时间段的数据
from p_warehousingmes
where YSID in(
select r.YSID as YSID
from p_stockmestemp r
inner join p_stockmes s
on r.Atype=s.Atype
where s.NowStock in(
select SUM(Amount) as Amount
from p_stockmestemp
group by Atype)
)
and ArrivalTime
Not between 'select to_char(add_months(sysdate,-2), ''yyyy-mm-dd hh24:mm'') from dual' and 'select to_char(sysdate,''yyyy-mm-dd hh24:mm'') from dual'
group by Atype
Not between 0 and 1
这里指查询出不在0和1之间的数据!
时间的书写方式
**‘2020-11-04’**需要使用单引号 ‘ 时间 ’
特殊情况:‘select to_char(add_months(sysdate,-2), ‘‘yyyy-mm-dd hh24:mm’’) from dual’ 内部时间格式用双单引号