高手帮忙看下,SQL问题,马上解决马上结贴~~~!!
oracle中计算一个日期减去相应天数得出日期的问题,
select to_date((select distinct s.Best_before_date
from m_stock_lot s
where s.item_cd = '6000004 '),
'yyyy-mm-dd hh24:mi:ss ')+ interval '31 ' day
from dual
上面这句就可以减去31天的时间算出原来的日期,但是31天,要从表中查到,用到下面之后就出现错误,
select to_date((select distinct s.Best_before_date
from m_stock_lot s
where s.item_cd = '6000004 '),
'yyyy-mm-dd hh24:mi:ss ') - interval (select nvl(deli_enable_days,0)
from m_item
where item_cd =
'6000004 ') day
from dual
帮忙看下~!!!!!!
------解决方案--------------------顶,慢慢等吧 ,一会就都吃饭去了!
------解决方案--------------------select to_date((select distinct s.Best_before_date
from m_stock_lot s
where s.item_cd = '6000004 '),
'yyyy-mm-dd hh24:mi:ss ') - (select nvl(deli_enable_days,0)
from m_item
where item_cd =
'6000004 ')
from dual
这样你试试