title: Assigning values during conditional statements
body: <p>I have been trying to insert values from table avergeclient into a table "finalresult", but I am getting syntax errors.</p>
  
  <p>I tried to search online for a solution, also checked the documentation but I could not find a solution to my problem, sorry for duplicate questions if I did not find one. At first, I was trying to use the as statement, then tried ":=" from the documentation, but none works.</p>
  
  <pre class="lang-sql prettyprint-override"><code>INSERT INTO finalresult
  select avg,
  CASE WHEN avergeclient.client_id = finalresult.clinet_id AND averageclient.month = finalresult.month
  THEN total := avg
  ELSE total := 0
  END
  FROM avergeclient;
  </code></pre>
  
  <p>Error I'm getting is </p>
  
  <p><code>LINE 4: THEN total := avg</code></p>