title: How to conditionally concatenate two table columns in query?
body: <p>I have a table like   </p>
  
  <pre><code>Description    SID        code          
  -----------    ----       ---------    
  ssdad          1001       S2378797     
  gfd            1002               
  gfdsffsdf      1003       R1165778     
  ssdad          1004       M0007867     
  gfd            1005       
  gfdsffsdf      1006       W5464111     
  </code></pre>
  
  <p>How do I concatenate <code>SID</code> and <code>code</code> to make it <code>SID-Code</code>, but if <code>code</code> is null, the result should not be like for example <code>1002-</code>. Instead it should contain only the <code>SID</code> without following <code>-</code>.</p>
  
  <p>The result should look like this:</p>
  
  <pre><code>Description    SID        code         SID-Code
  -----------    ----       ---------    ---------
  ssdad          1001       S2378797     1001-S2378797
  gfd            1002                    1002
  gfdsffsdf      1003       R1165778     1003-R1165778
  ssdad          1004       M0007867     1004-M0007867  
  gfd            1005                    1005
  gfdsffsdf      1006       W5464111     1006
  </code></pre>