title: Join two select queries horizontally in Postgresql
body: <p>I have following two queries:</p>
  
  <p>Query #1:</p>
  
  <pre><code>(SELECT 
      pl.c_project_Id, pl.c_projectphase_Id, pl.c_projecttask_Id, pl.m_product_Id,
      pj.name as projectname, ph.name as phasename, pt.name as taskname, pd.name as prodname,
      round(pl.plannedqty, 2) as planqty, round(pl.plannedprice, 2) as planrate,
      round(pl.plannedamt, 2) as planamt
  
  FROM adempiere.c_projectline pl
  LEFT JOIN adempiere.c_project pj ON pl.c_project_id = pj.c_project_id
  LEFT JOIN adempiere.c_projectphase ph ON pl.c_projectphase_id = ph.c_projectphase_id
  LEFT JOIN adempiere.c_projecttask pt ON pl.c_projecttask_id = pt.c_projecttask_id
  LEFT JOIN adempiere.m_product pd ON pl.m_product_id = pd.m_product_id
  WHERE pl.c_project_id = 1000001 AND pl.ad_client_id = 1000000
  ORDER BY ph.c_projectphase_id, pt.c_projecttask_id)
  </code></pre>
  
  <p>Output is: 11 columns and 16 rows</p>
  
  <p>Query #2:</p>
  
  <pre><code>(SELECT
      fa.c_project_id, fa.c_projectphase_id, fa.c_projecttask_id, fa.m_product_id,
      pj.name as costprojectname, ph.name as costphasename, pt.name as costtaskname,
      pd.name as costprodname,
      abs(fa.qty) as costqty, round((fa.amtacctdr/fa.qty), 2) as costrate,
      round(sum(fa.amtacctdr), 0) as costamt
  
  FROM adempiere.fact_acct fa
  LEFT JOIN adempiere.c_project pj ON fa.c_project_id = pj.c_project_id
  LEFT JOIN adempiere.c_projectphase ph ON fa.c_projectphase_id = ph.c_projectphase_id
  LEFT JOIN adempiere.c_projecttask pt ON fa.c_projecttask_id = pt.c_projecttask_id
  LEFT JOIN adempiere.m_product pd ON fa.m_product_id = pd.m_product_id
  WHERE  fa.c_project_id = 1000001 AND (fa.gl_category_id = 1000006 OR fa.gl_category_id = 1000005)
  AND fa.qty &gt; 0 AND fa.c_project_id is not null
  GROUP BY fa.m_product_id, fa.c_project_id, fa.c_projectphase_id, fa.c_projecttask_id,
          fa.qty, fa.amtacctdr,
          pj.name, ph.name, pt.name, pd.name)
  </code></pre>
  
  <p>Output is: 11 columns and 6 rows</p>
  
  <p>I want to join these queries horizontally, display all columns but rows should not duplicate. As when I apply union to join them the result shows duplicate rows. How can I cope with this issue?</p>