title: How to Sumif a Sum
body: <p>I am trying to get a "total override" but only sum if the agent = x,y or z</p>
  
  <pre><code>SELECT   
      DISTINCT( "public"."rdf_dean"."agent_name" )  AS "Agent",
      SUM("public"."rdf_dean"."paidcomm" *.9) AS "Paid to Agent",
      SUM("public"."rdf_dean"."paidcomm" *.1) AS "Overrides",
      SUM overrides IF agent_name = x OR agent_name = y OR agent_name = z
  
  FROM     "public"."rdf_dean"
  WHERE "public"."rdf_dean"."created_date" = date(now())
  GROUP BY agent_name
  </code></pre>