Archiv für den Monat: Dezember 2016

SQL: Gestern, letzte Woche, letzter Monat

select
  -- Last month period
  trunc(sysdate, 'mm') - interval '1' month last_month_start,
  trunc(sysdate, 'mm') - interval '1' second last_month_end,
  -- Last week period
  trunc(sysdate, 'iw') - interval '7' day last_week_start,
  trunc(sysdate, 'iw') - interval '1' second last_week_end,
  -- Last day period
  trunc(sysdate, 'dd') - interval '1' day last_day_start,
  trunc(sysdate, 'dd') - interval '1' second last_day_end
from dual

SQL: Gestern, letzte Woche, letzter Monat weiterlesen