title: select two tables and view in a table
body: <p>I’ve a BD with the next tables.</p>
  
  <p><strong>TABLE detalle_contrato</strong></p>
  
  <p><a href="https://i.stack.imgur.com/imQqt.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/imQqt.png" alt="enter image description here"></a></p>
  
  <p><strong>TABLE detalle_tradicional</strong></p>
  
  <p><a href="https://i.stack.imgur.com/kv1Rk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kv1Rk.png" alt="enter image description here"></a></p>
  
  <p>There is a relation with <code>ID_CONTRATO</code> and i need to view the table with the next data.</p>
  
  <pre><code>SELECT
      ID_CONTRATO,
      TRADICIONAL,
      NOM_VARIEDAD,
      SUM(CANTIDAD)
  FROM detalle_contrato
  WHERE ID_CONTRATO = '$ID' AND TIPO_VARIEDAD = 'TRADICIONAL';
  
  SELECT
      SUM(CANTIDAD_D)
  FROM detalle_tradicional
  WHERE ID_CONTRATO = '$ID'
  GROUP BY NOM_VARIEDAD ";
  </code></pre>
  
  <p>There are a filter different in this two select and I need this in a table but i don't know together.</p>
  
  <p>The idea is this:</p>
  
  <pre><code>ID_CONTRATO, 
  NOM_VARIEDAD, 
  CANTIDAD
      ( THIS IS THE SUM THE ALL CANTIDAD DUKE AND 
        LEGACY IN GROUP THE TABLE DETALLE_CONTRATO) ,
  CANTIDAD_D
      (TABLE DETALLE_TRADICIONAL THIS IS SUM 
      THE ALL DUKE AND LEGACY SEPARATE THE CANTIDAD_D
  </code></pre>
  
  <p>I need exactly this using the data the photos</p>
  
  <p><a href="https://i.stack.imgur.com/vsDzM.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/vsDzM.png" alt="enter image description here"></a></p>