我也這是會自動運行一個月多次發表聲明如下:使用的條件與CASE上的Oracle SQL
select
case
when to_char(sysdate, 'MM') <> '03' or (to_char(sysdate, 'MM')= '03'
and count(a.cust_id) >'1000000') then '0'
when to_char(sysdate, 'MM')= '03' and count(a.cust_id) <'1000000' then '1'
end
from table a
where a.template_id = '99'
and a.start_date >= sysdate-1
由於計語句運行很長時間,我想補充一個條件 ,只允許它在當前月份是3月份時運行。當它不是三月它應該只顯示'0'
任何想法如何做到這一點?可以在這裏使用ELSE嗎?
謝謝, Assaf。
聽起來。 –