title: in postgresql inner join gives result for id in single line
body: <p>This is my query:</p>
  
  <pre><code>  SELECT    (sc.contract_number) AS id,
              to_char(sc.contract_date, 'DD/MM/YYYY') AS "Contract Date",
              (sc.cust_name) AS "Customer Name",
              (
               SELECT pt.product_desc
               FROM   product_product pp,
                      product_template pt
               WHERE  pt.id = pp.product_tmpl_id AND
                      type = 'service' AND
                      pt.name LIKE sc.pms_lines
              ) AS "PMS",
              CASE WHEN sc.parent_ref IS NULL THEN ROUND(sc.basic_amount)
                   ELSE 0
              END AS "New Amount",
              CASE WHEN sc.parent_ref IS NULL THEN 0
                   ELSE ROUND(sc.basic_amount)
              END AS "Renew Amount",
              ROUND(sc.service_tax_amount + sc.edu_tax_amount +
                    sc.hs_edu_tax_amount) AS "Service Tax",
              ROUND(sc.grand_total_amount) AS "Total"
    FROM      sale_contract sc
    INNER JOIN inspection_costing_line icl ON (sc.id = icl.id)
    WHERE     sc.contract_date BETWEEN '2015-03-02'
                               AND     '2015-03-10'
    ORDER BY  sc.contract_number ASC;
  </code></pre>
  
  <p>I am getting this result:</p>
  
  <pre><code>    id              | Contract Date |           Customer Name           | PMS             | New Amount | Renew Amount | Service Tax | Total 
  --------------------|---------------|-----------------------------------|-----------------|------------|--------------|-------------|-----------
  P114CO15004025      | 03/03/2015    | Farhan Farooqui                   | GSS             |          0 |         2200 |         272 |   2472
  P114CO15004026      | 03/03/2015    | R K Builders                      | TSPO            |       3000 |            0 |         371 |   3371
  P114CO15004027      | 03/03/2015    | Jivesh Terrace                    | PSS , IMM , PPS |          0 |        60000 |        7416 |  67416
  </code></pre>
  
  <p>Expected result</p>
  
  <pre><code>    id              | Contract Date |           Customer Name           | PMS             | New Amount | Renew Amount | Service Tax | Total 
  --------------------|---------------|-----------------------------------|-----------------|------------|--------------|-------------|-----------
  P114CO15004025      | 03/03/2015    | Farhan Farooqui                   | GSS             |          0 |         2200 |         272 |   2472
  P114CO15004026      | 03/03/2015    | R K Builders                      | TSPO            |       3000 |            0 |         371 |   3371
  P114CO15004027      | 03/03/2015    | Jivesh Terrace                    | PSS             |          0 |        60000 |        7416 |  67416
  P114CO15004027      | 03/03/2015    | Jivesh Terrace                    | IMM             |          0 |        60000 |        7416 |  67416
  P114CO15004027      | 03/03/2015    | Jivesh Terrace                    | PPS             |          0 |        60000 |        7416 |  67416
  </code></pre>