title: Can I Return Following Statement As Static in SQL Server?
body: <pre><code>  ------------------------------
    |  User Name   |   Falg       |
    -------------------------------
    |  Kapil       |  Attendance  |
    -------------------------------
    |  Kapil       |  Field       |
    --------------------------------
    |  Khan        |  Attendance  |
    -------------------------------
    |  Sri         |  Attendance  |
    -------------------------------
    |  Raja        |  Field       |
    -------------------------------
  </code></pre>
  
  <p>Desire Output :</p>
  
  <pre><code>  --------------------------------------------
    |  User Name   |   Activity1  |  Activity2  |
    ---------------------------------------------
    |  Kapil       |  Attendance  |  Field      |
    ---------------------------------------------
    |  Khan        |  Attendance  |  Field      |
    ---------------------------------------------
    |  Sri         |  Attendance  | Null        |
    ---------------------------------------------- 
  </code></pre>
  
  <p>I have tried this so far
  the query for the same goes like this</p>
  
  <pre><code>   Select User_Code, DCR_Actual_Date, Flag "Activity1" From Tbl_Sfa_DCR_Master 
  Where DCR_Status in(1,2) and Flag ='A' 
  and DCR_Actual_Date Between '2014-01-01' and '2014-12-31')T1 
  On (T1.User_Code =T0.User_Code and T1.DCR_Actual_Date=T0.[DCR_Date]) 
  Left Outer Join (Select User_Code, DCR_Actual_Date, Flag "Activity2" 
  From Tbl_Sfa_DCR_Master Where DCR_Status in(1,2) 
  and Flag ='F' and DCR_Actual_Date Between '2014-01-01' and '2014-12-31')T2 
  On (T2.User_Code =T0.User_Code and T2.DCR_Actual_Date=T0.[DCR_Date])
  </code></pre>
  
  <p>Can Any One Help Me Out. Can I Write a Query As Static ?</p>