title: Returning a value of a column as null or empty when a value of other column in the same table is 1
body: <p>I am working on an SQL Query which has some joins which results certain number of rows and columns. I am trying to return the results in such a way that when a value in particular column of a row is 1 then some other value in the same row but different column should be returned as Empty value.</p>
  
  <p>My SQL Query in SQL Server 2012 is as follows</p>
  
  <pre><code>select a.id,a. Date, c.companyname as 'Active Company', h.employee_fullname as ‘Client',j.displayname as 'Seller Employee', d.companyName as 'CounterParty Company',g.broker_fullname as 'Buyer Trader', a.transactiontype
  from confirmations a with (nolock)
  left join company c with (nolock) on c.company_id = a.activecompany
  left join company d with (nolock) on d.company_id = a.counterCompany
  left join bprod e with (nolock) on e.id = a.productID
  left join btype f with (nolock) on  f.id = a.quantitytypeid
  left join companybroker g with (nolock) on g.companybroker_id = a.counter
  left join companybroker h with (nolock) on h.companybroker_id = a.active
  left join users i with (nolock) on i.id = a.buyemp
  left join users j with (nolock) on j.id = a.sellemp
  Where JoinDate &gt; '2011-06-04 00:00:00' 
  and a.disabled = 0 
  order by dealid
  </code></pre>
  
  <p>Above Query returns following results</p>
  
  <pre><code>Id Active Company Client Seller Employee CounterPartyCompany Buyer Trader Transaction Type
  1  ABC             XYZ      PQR             CHEV                 John           0
  2  ABC2            2XYZ    2PQR            2CHEV                 John11         0
  3  3ABC            3XYZ     3PQR           3CHEV                 John12         1
  4  3ABC            3XYZ     AAA              CCC                 John12         1
  </code></pre>
  
  <p>Everything looks fine but I am trying to return <code>CounterPartyCompany</code> as Empty when  <code>Transaction Type</code> is 1 which looks like following</p>
  
  <pre><code> Id Active Company Client Seller Employee CounterPartyCompany Buyer Trader Transaction Type
      1  ABC             XYZ      PQR             CHEV                 John           0
      2  ABC2            2XYZ    2PQR            2CHEV                 John11         0
      3  3ABC            3XYZ     3PQR                                 John12         1
      4  3ABC            3XYZ     AAA                                  John12         1
  </code></pre>
  
  <p>May I know a better way to solve this</p>