我的查询有问题。我不知道如何计算日期的数据。我想显示从月初到一个月前的日期。
比如今年。从一月到九月。本月不包括在内。我对这种情况有疑问
and mhn.trh_masuk between add_months(Last_day(sysdate) + 1, -10) and add_months(Last_day(sysdate) + 0, -2)
这是我的 oracle sql:
select DISTINCT
count(mhn.id_mohon) ide,
add_months(Last_day(sysdate)+1,-10) datejan,
add_months(Last_day(sysdate)+0,-2) onemonthbeforenow,
ku.nama u4
from
mohon mhn, kod_urusan ku, kod_caw kc
where
mhn.kod_urusan = ku.kod(+)
and mhn.kod_caw = kc.kod(+)
AND KU.AKTIF = 'Y'
AND KU.KOD_JABATAN= 2
and mhn.trh_masuk between add_months(Last_day(sysdate)+1,-10) and add_months(Last_day(sysdate)+0,-2)
and (mhn.kod_caw = :p_kod_caw or :p_kod_caw is null)
and (mhn.kod_urusan in ('PBMT','PBMMK'))
group by ku.nama
有人知道这个解决方案的其他公式吗?