Insert multiple data into a mysql column

0

Good afternoon, I'm breaking my head about how I do this insertion in the bank, it's something like this ...

I have a product, which needs to be priced from more than one vendor, to compare prices. But my quantity of supplier depends on the quantity registered, I do not have a fixed number.

So far I have two tables, a supplier tabale, where I register suppliers, and a products table, where I register the products and relate to the supplier table, through the foreign key vendor_id.

Thank you in advance!

    
asked by anonymous 22.01.2017 / 18:16

1 answer

1

You will need an associative table. Since a product needs to relate to many suppliers and a supplier can have many products.

In this associative table you can have one of the columns ID , ID_PROD , ID_FORN , PRECO .

In this way, you can solve your problem. For each price offered by each supplier, you can fill in this table with the product ID, vendor ID, and price of that item.

TIP: The item_product table is usually created. In this item, you can even have the quantity of the product, but I do not know if it is interesting for you at the moment.

    
22.01.2017 / 18:23