title: Update and delete together on PostgreSQL
body: <p>I have a problem on my postgreSQL query.
  I must do a query with an UPDATE before and a DELETE after.
  The return value is the number of UPDATEs but I want the count of DELETEs.
  How can I do? Thank you very much.
  I use myBatis.</p>
  
  <pre><code>&lt;update id="updateSpotMetaDataTagIdsToDelete"&gt;
      &lt;bind name="simulatedById" value="_parameter.spotUpdate.userOwner.getSimulatedById()" /&gt;
  
      &lt;foreach item="id" collection="spotUpdate.spotMetaDataTagIdsToDelete" separator=";" &gt;
          UPDATE spotsmetadatatags
          SET updatedate = now(),
          simulatedBy = #{simulatedById},
          fkuserowner = #{spotUpdate.userOwner.id},
          sessionId = #{spotUpdate.userOwner.sessionId}
          WHERE
          id = #{id}
          AND fkIdSpot = #{spotUpdate.fkIdSpot}
          AND (SELECT COUNT(*)
          FROM spots as s
          WHERE s.id = #{spotUpdate.fkIdSpot}
          AND s.fkIdOrganization = #{spotUpdate.userOwner.organization.id}) = 1
      &lt;/foreach&gt;;
  
      DELETE FROM spotsmetadatatags
      WHERE fkIdSpot = #{spotUpdate.fkIdSpot}
      AND id IN (
      &lt;foreach item="id" collection="spotUpdate.spotMetaDataTagIdsToDelete" separator="," &gt;
          #{id}
      &lt;/foreach&gt;
      )
      AND (SELECT COUNT(*)
      FROM spots as s
      WHERE s.id = #{spotUpdate.fkIdSpot}
      AND s.fkIdOrganization = #{spotUpdate.userOwner.organization.id}) = 1;
  &lt;/update&gt;
  </code></pre>