title: One SQL Stored Procedure to get cut off date of two different cut off date format
body: <p>I have one system that read from two client databases. For the two clients, both of them have different format of cut off date: </p>
  
  <p>1) Client A: Every month at 15th. Example: 15-12-2016.</p>
  
  <p>2) Client B: Every first day of the month. Example: 1-1-2017.</p>
  
  <p>The cut off date are stored in the table as below:
  <a href="https://i.stack.imgur.com/caStW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/caStW.png" alt="enter image description here"></a></p>
  
  <p>Now I need a single query to retrieve the current month's cut off date of the client. For instance, today is 15-2-2017, so the expected cut off date for both clients should be as below:</p>
  
  <p>1) Client A: 15-1-2017</p>
  
  <p>2) Client B: 1-2-2017</p>
  
  <p>How can I accomplish this in a single Stored Procedure? For client B, I can always get the first day of the month. But this can't apply to client A since their cut off is last month's date. </p>