1
I have a purchase order table, which relates to the products table, The purchase order table can own multiple products,
this consultation returns me all the purchase order, which has more than one product, duplicated.
SELECT * FROM unisis.ordem_de_compra
inner JOIN unisis.oc_produtos
ON ordem_de_compra.id = oc_produtos.id_ordem_de_compra
where oc_date BETWEEN CURRENT_DATE()- INTERVAL 30 DAY AND CURDATE() and centro_custo = 'Balança'
the problem of the query is that example( if I have a purchase order with 3 registered products, it returns me as follows
id:25 customer: Alberto id_product: 1 product: a
id:25 customer: Alberto id_product: 2 product: b
id:25 customer: Alberto id_product: 3 product: c
I’d like her to return to me in the following manner
id:25 client: Alberto
id_product: 1 product: a
id_product: 2 product: b
id_product: 3 product: c
I believe that either something is missing or there is something too much in the ON clause of its conjunction.
– anonimo
What do you want to do with the query? What query is returning? Has error message?
– Marcelo Shiniti Uchimura
ON ordem_de_compra.id = oc_produtos.id_ordem_de_compra and ordem_de_compra.id this line is wrong, the rest is missing after and
– Heitor Scalabrini
sorry really was wrong the consultation, I arranged
– MaykBr