How to use Case when Then Select statement in Sql-Server
<p>Can anyone help me to write this conditions using case when then.</p>

<pre><code>SELECT CASE
 WHEN D.AppEmployeeID = D.ByEmployeeID AND D.CommentStatus = 'A' THEN D.CreatedOn, E.FirstName, E.LastName, D.Remarks, D.Attachment
 WHEN D.AppEmployeeID &lt;&gt; D.ByEmployeeID AND D.CommentStatus = 'R' THEN D.CreatedOn, E.FirstName, E.LastName, D.Remarks, D.Attachment
FROM tbl_Conversation_History D
INNER JOIN tbl_Employee_Master E on D.ByEmployeeID = E.EmployeeID
WHERE D.AppEmployeeID = @EmployeeID AND D.ByEmployeeID IN (@EmployeeID, @ReportingMg, @DelegatedMgr) AND SubAppraisalID=@SubAppraisalID 
AND D.Attachment IS NULL
ORDER BY D.CreatedOn DESC
</code></pre>