sql help using two different tables

0

I need help to make queries via SQL ; I have two tables, one of products and the other output of products, here the code

 Select 
        saiprod_codproduto,
        saiprod_quantidade,
        saiprod_valorproduto,
        saiprod_valortotal
  from  saida_produto where  
        saiprod_cod_saida_pai = 1 \aqui viene una variable este valor para prueba
      group by
        saiprod_codproduto,
        saiprod_quantidade,
        saiprod_valorproduto,
        saiprod_valortotal

Result, two records equivalent to note number 1

Result

(1, 1, 7000, 5200);
(2, 1, 5200, 5200);

We have the code 1 and 2, now what I need is the name of the product, which is in another table

    
asked by Derlis Luis Gonzalez Espinola 30.08.2017 в 04:25
source

1 answer

0

It should work, here I leave you the cleanest code

SELECT s.saiprod_codproduto, e.est_produto, s.saiprod_quantidade, s.saiprod_valorproduto, s.saiprod_valortotal FROM saida_produto s INNER JOIN estoque e ON s.saiprod_codproduto=e.est_produto WHERE s.saiprod_cod_saida_pai = 1 GROUP BY 1,3,2,4,5

Attach the error message if it comes out ...

    
answered by 04.12.2018 в 23:04