title: Case Statement in WHERE or in the SELECT clause
body: <p>I have the following query:</p>
  
  <pre><code>-- COLUMN SELECTION
  -- INITIAL ENCOUNTERS
  SELECT pt_no AS 'INITIAL ENCOUNTER'
  , Episode_No AS 'INITIAL EPISODE NO'
  , med_rec_no, pt_name AS 'PT NAME'
  , adm_src_desc AS 'INITIAL ADM SOURCE'
  , adm_date AS 'INITIAL ADM DATE'
  , dsch_date AS 'INITIAL DISC DATE'
  , DATEDIFF(DD,ADM_DATE,DSCH_DATE) AS 'INITIAL LOS'
  , pyr1_co_plan_cd AS 'INITIAL INSURANCE'
  , mdc_name AS 'INITIAL MDC'
  , clasf_desc AS 'INITAL CLASF'
  , Admit_Adm_Dr_Name AS 'INITIAL ADMIT DR'
  , Admit_Atn_Dr_Name AS 'INITIAL ATTENDING'
  , Days_To_Readmit
  ,
  -- READMISSION ENCOUNTERS 
  B_Pt_No AS 'READMIT ENCOUNTER'
  , B_Episode_No AS 'READMIT EPISODE NO'
  , B_Adm_Src_Desc AS 'READMIT SOURCE'
  , B_Adm_Date AS 'READMIT DATE'
  , B_Dsch_Date AS 'READMIT DISC DATE'
  , DATEDIFF(DD,B_ADM_DATE,B_DSCH_DATE) AS 'READMIT LOS'
  , B_Pyr1_Co_Plan_Cd AS 'READMIT INSURANCE'
  , B_Mdc_Name AS 'READMIT MDC'
  , B_Clasf_Desc AS 'READMIT CLASF'
  , B_Readm_Adm_Dr_Name AS 'READMIT ADMITTING DR'
  , B_Readm_Atn_Dr_Name AS 'READMIT ATTENDING DR'
  , B_Days_To_Readmit
  
  -- DB USED
  FROM smsdss.c_readmissions_v
  
  -- FILTERS USED
  WHERE adm_date BETWEEN '2012-05-01' AND '2013-04-30'
  AND adm_src_desc != 'SCHEDULED ADMISSION'
  AND pt_no &lt; 20000000
  AND B_Adm_Src_Desc != 'SCHEDULED ADMISSION'
  AND B_Pt_No &lt; 20000000
  AND B_Dsch_Date IS NOT NULL
  --AND pyr1_co_plan_cd IN (
  --CASE WHEN pyr1_co_plan_cd = '*' THEN 'Self Pay'
  --     ELSE pyr1_co_plan_cd
  --END
  --)
  --AND B_Pyr1_Co_Plan_Cd IN (
  --CASE WHEN B_Pyr1_Co_Plan_Cd = '*' THEN 'SELF PAY'
  --     ELSE B_Pyr1_Co_Plan_Cd
  --END 
  --)
  </code></pre>
  
  <p>In the results <code>pyr1_co_plan_cd</code> and <code>B_pyr1_plan_cd</code> can both be equal to <code>*</code></p>
  
  <p>I would like to use a <code>CASE</code> statement in order to force the <code>*</code> to turn out as <code>'Self Pay'</code></p>
  
  <p>The way I currently have the CASE statement ends up kicking out the accounts I am trying to force the case on, meaning those cases no longer hit my result set.</p>
  
  <p>I did try using a CASE statement in the WHERE clause as shown <a href="https://stackoverflow.com/questions/1257516/case-statement-in-where-clause-w-an-or">here</a></p>
  
  <p>Thank You</p>