title: Postgresql update query (with a subquery) error
body: <p>I am getting error on this query. The first inner query is executing properly while we run it independently. But while I include the same in the complete query, its prompting the error.  </p>
  
  <pre><code>UPDATE GL_BudgetPlanDetails bpd 
  SET (CommittedAmt07) = (
          SELECT SUM (case
              when fa.amtacctdr &gt; 0 then (fa.amtacctdr*-1)
              when fa.amtacctcr &gt; 0 then fa.amtacctcr else 0 end )
          FROM fact_acct fa
          WHERE fa.datetrx between '2014-09-01' and '2014-09-30'
            AND fa.isactive ='Y'
            AND fa.account_ID =758
            AND fa.AD_Client_ID =11
            AND fa.AD_Org_ID =50001)
  WHERE (
          (
              SELECT gbp.c_year_id
                FROM GL_BudgetPlan gbp
               WHERE gbp.GL_BudgetPlan_ID = bpd.GL_BudgetPlan_ID
                 AND gbp.isactive ='Y'
          ) = '2014'
        )
  AND bpd.account_ID =758
  </code></pre>