title: Avoiding Cartesian product on sql query
body: <p>I got a cartesian product but can't find a way to prevent it...</p>
  
  <p>I tried to simplify my query to the strict minimum :</p>
  
  <pre><code>select
      SUM(tableA.amount) as "Total Amount"
  from
      tableA,
      tableB,
  where
      tableA.id= 12 and
      tableB.id= 10
  </code></pre>
  
  <p>The problem here is that tableB has 3 resulting rows so the total amount is added 3 times (cause of result from tableB). I can't figure out how to specify that I just want the last result from tableB, I guess that would solve the problem.</p>
  
  <p><strong>table A : id | amount</strong></p>
  
  <p><strong>table B :
  id | date | comment</strong></p>
  
  <p>EDIT: I commented but might have added it on the original post: I need that tableB on my query (can't remove it) and the difference between each row returned by this tableB is the date column</p>