title: Incorrect sum of columns on second table when using 2 inner joins
body: <p>I have 3 SQLite tables customer: sale and invoice. The sum that I get on <code>invoice.amount</code> is incorrect in the below query but the <code>sum.amount</code> on sale table is correct.</p>
  <p>My query is:</p>
  <pre><code>SELECT  sum(invoice.amount)  as 'amt' 
         , customer.name
         , sum(sale.amount) as 'amt1' 
  FROM    customer 
            INNER JOIN sale on customer.customer_id  = sale.customer_id 
            INNER JOIN invoice on customer.customer_id = invoice.customer_id
  WHERE  (
           (sale.date &lt;='2022-04-30') and 
           (invoice.date &lt;='2022-04-30') and 
           customer.area='xyz' and 
           ( 
               customer.status='Active' OR 
               customer.status='Inactive'
           ) 
  ) 
  GROUP BY customer.customer_id 
  ORDER BY customer.delseq ASC
  </code></pre>
  <p>If I only use one inner join as shown below, and skip sale table, then I get correct results.</p>
  <pre><code>SELECT  sum(invoice.amount)  as 'amt' 
         , customer.name 
  FROM   customer 
             INNER JOIN invoice ON customer.customer_id = invoice.customer_id
  WHERE  (
            ( invoice.date &lt;='2022-04-30') and 
              customer.area='xyz' and 
              ( 
                 customer.status='Active' 
                 OR 
                 customer.status='Inactive'
              ) 
  ) 
  GROUP BY customer.customer_id 
  ORDER BY customer.delseq ASC
  </code></pre>