title: use UPDATE and INSERT in same query
body: <p>Can I do an insert and update in same query?</p>
  
  <p><strong>BEFORE</strong>:</p>
  
  <pre><code>MemberID |   SubsID |   StartDate  |  EndDate
  ------------------------------------------------
  1001     |   10     |   2012-12-21 |  2012-12-31 
  2002     |   10     |   2012-12-22 |   
  </code></pre>
  
  <p><strong>AFTER</strong>:</p>
  
  <pre><code>MemberID |   SubsID |   StartDate  |  EndDate
  ------------------------------------------------
  1001     |   10     |   2012-12-21 |  2012-12-31 
  2002     |   10     |   2012-12-22 |  2012-04-13 
  2002     |   10     |   2012-04-13 |   
  </code></pre>
  
  <p><em>Get the rows</em>:</p>
  
  <pre><code>select * from MemberSubs 
  where SubsID = 10 and EndDate is null;
  </code></pre>
  
  <p><em>Insert new rows</em>:</p>
  
  <pre><code>insert into 
    MemberSubs(MemberID, SubsID, Price, StartDate)
  select 
    MemberID, SubsID, Price, Current Date 
  from 
    MemberSubs 
  where 
    SubsID = 10
    and
    EndDate is null
  </code></pre>
  
  <p><em>Update the old rows</em>:</p>
  
  <pre><code>update MemberSubs 
  set 
    EndDate = current date
  where 
    SubsID = 10
    and
    EndDate is null
    and
    StartDate &lt; Current Date
  </code></pre>
  
  <p>Is it possible to achieve this in one query (without using stored procedures or trigger etc)</p>
  
  <p>Thank you.</p>