title: Displaying current and previous pay period in SQL (based on an imported table)
body: <p>I need to display the current AND last pay periods based on an imported table for biweekly pay dates. The table looks something like this:</p>
  
  <pre><code>2017-03-23 00:00:00 2017-04-06 00:00:00
  2017-04-07 00:00:00 2017-04-20 00:00:00
  2017-04-21 00:00:00 2017-05-06 00:00:00
  2017-05-07 00:00:00 2017-05-20 00:00:00
  2017-05-21 00:00:00 2017-06-05 00:00:00
  2017-06-06 00:00:00 2017-06-22 00:00:00
  2017-06-23 00:00:00 2017-07-06 00:00:00
  2017-07-07 00:00:00 2017-07-21 00:00:00
  </code></pre>
  
  <p><strong>This code:</strong></p>
  
  <pre><code>     SELECT * 
       FROM 
         table1
       WHERE  
         (start_date &lt;= now()  AND end_date &gt;= now())
  </code></pre>
  
  <p><strong>Displays:</strong></p>
  
  <pre><code>2017-06-06 00:00:00 2017-06-22 00:00:00
  </code></pre>
  
  <p><strong>How can I display the previous pay period? 
  Such as:</strong></p>
  
  <pre><code>2017-05-21 00:00:00 2017-06-05 00:00:00
  </code></pre>
  
  <p>This code just doesn't even look right, but I tried it anyways:</p>
  
  <pre><code>SELECT start_date,
  CASE 
      WHEN start_date = now() THEN    start_date = now() - 1
      WHEN end_date = now() THEN start_date = now() - 1
  END
  FROM table1;
  </code></pre>
  
  <p>I know there is a way to use <code>CASE WHEN</code> but for some reason, I cannot get the syntax right using <code>now()</code> since I want it to be dynamic and not a static date.</p>