title: SQL syntax: Concatenating multiple columns into one
body: <p>I am using PostgreSQL 9.2. I need to copy the addresses (which are split across multiple columns) from this table entitled houses: </p>
  
  <pre><code> house_id | unit_number| street_number | street| street_extension| suburb | postcode | state | sale_price | sale_date |
  ----------+------------+-------+-------+-------+-----------------+--------+----------+-------+------------+-----------+
      1     |    2       |  17           | Rose  |     Av          |  Rye   | 3099     | VIC   | 240000     | 2003-12-02|
      2     |            |  3            | Jack  |     St          |  Rye   | 3099     | VIC   | 260000     | 2003-10-02|
  </code></pre>
  
  <p>into a single column in this table entitled address_list:</p>
  
  <pre><code>house_id  |                 address                  | formatted_address | lat | lon | wkb_geometry | is_processed 
  ----------+------------------------------------------+-------------------+-----+-----+--------------+--------------
            |                                          |                   |     |     |              |  
            |                                          |                   |     |     |              |  
  </code></pre>
  
  <p>My syntax is </p>
  
  <pre><code>INSERT INTO address_list (house_id, address)
  SELECT house_id, unit_number || '/' || street_number || ' ' || street || ' ' || street_extension || ', ' || suburb || ', ' || state || ' ' || postcode 
  FROM houses;
  </code></pre>
  
  <p>My syntax does not work because of some null entries in the unit_number field of the source table. </p>
  
  <p>Is there a way of copying the unit_number plus a "\" if NOT NULL, and ignoring the unit_number field and the "\" IF NULL? </p>
  
  <p>I have spent several hours searching for a solution without luck so I would be extremely grateful for any assistance.</p>