MySql - Insert multiple products into one order

0

I have a request table in mysql, where it must be informed the total value of the request, the date, the customer id, and the products that were purchased. The problem that these products is in the product table. I would like to know how do I insert these various products with the sql command? Insert only one product I know of good. I will use this in a C # Web application, where the client selects the products on a grid and confirms the request.

    
asked by anonymous 20.02.2016 / 17:43

1 answer

-1

Vanderson, let's suppose that this is your table compras with the following columns:

id, total_pedido, data, id_cliente

You would have to have a pedido_detalhes table that had the following columns:

idproduto, idcompra

So whenever a purchase was inserted, it would generate a ID that would be saved next to all products purchased in the pedido_detalhes table.

    
20.02.2016 / 19:22