title: Sysdate minus 2 different days
body: <p>I am running this query currently for one scenario but I have two scenarios: If SYSDATE = Monday, then run "SYSDATE - 2", otherwise run "SYSDATE - 1". I'm connecting to the database via an OLE connection from Excel so I'm not sure I can use a stored procedure. Is there a way to write the query to accomplish both scenarios? Thanks for all help.</p>
  
  <pre><code>SELECT 
     DISTINCT VERSION_NAME VERSION, MIN(RECONCILE_START_DT) DATES
  FROM
     SDE.GDBM_RECONCILE_HISTORY
  WHERE
      RECONCILE_RESULT = 'Conflicts'
  AND
      RECONCILE_START_DT &gt; SYSDATE -1
  GROUP BY VERSION_NAME
  ORDER BY 2 ASC NULLS LAST
  </code></pre>