title: SQL : Split one row into two rows depending on column
body: <p>I am sorry if this is duplicate. Please point me to correct question. I am using SQL SERVER 2008. I am using below query since I need to get data from 3 tables.</p>
  
  <pre><code>SELECT qc.FileID as [FileID],    
  qc.QID1 as [QID1],    
  xqs.SID1 as [SID1],   
  xqc.CID1 as [CID1],  
  xqs.Comments as [SComments],  
  xqc.Comments as [CComments]  
  FROM QCTable(nolock) qc  
  JOIN QCSectionTable (nolock) xqs ON qc.QCID = xqs.QCID  
  LEFT JOIN QCChargeTable (nolock) xqc ON xqc.QCXrefID = xqs.QCXrefID
  </code></pre>
  
  <p>For above I am getting this like
  FieID1 SID1 SID1 CID1 SComments CComments</p>
  
  <p>I have a row like below</p>
  
  <pre><code>FileID1  QID1 SID1 CID1 SComments  CComments
  </code></pre>
  
  <p>I need to split above row as</p>
  
  <pre><code>FileID1 QID1 SID1 null SComments
  FileID1 QID1 SID1 CID1 CComments
  </code></pre>
  
  <p>Thanks in advance.</p>