title: SQL: Filtering a query with multiple conditions
body: <p>As I'm sure you'll be able to tell from this question, I am very new and unfamiliar with SQL. After quite some time (and some help from this wonderful website) I was able to create a query that lists almost exactly what I want:</p>
  
  <pre><code>Select p1.user.Office, 
  p1.user.Loc_No, 
  p1.user.Name, 
  p1.user.Code, 
  p1.user.Default_Freq, 
  (Select distinct MAX(p2.pay.Paycheck_PayDate) 
  from p2.pay
  where p1.user.Client_TAS_CL_UNIQUE = p2.pay.CL_UniqueID) as Last_Paycheck
  
  from
  PR.client 
  
  where 
  p1.user.Client_End_Date is null
  and p1.user.Client_Region = 'Z'
  and p1.user.Client_Office &lt;&gt; 'ZF'
  and substring(p1.user. Code,2,1) &lt;&gt; '0'
  </code></pre>
  
  <p>Now I just need to filter this slightly more using the following logic:</p>
  
  <p>If Default_Freq = 'W' then only output clients with a Last_Paycheck 7 or more days past the current date</p>
  
  <p>If Default_Freq = 'B' then only output clients with a Last_Paycheck 14 or more days past the current date</p>
  
  <p>Etc., Etc. </p>
  
  <p>I know this is possible, but I have no clue how the syntax should start. I believe I would need to use a Case statement inside the Where clause? Any help is greatly appreciated as always!</p>