N
N
Noob--Saibot2017-02-26 22:33:06
MySQL
Noob--Saibot, 2017-02-26 22:33:06

How to save in mysql in this way and make a fetch?

For example, there are fields, id, pole1, pole2.
How to write in them like:

INSERT INTO table (pole1, pole) VALUES ('1,5,8', 'text kakoi-to');

And then make a selection as follows:
select * from table where <b>pole1='5'</b>
The table stores the product and the categories to which it belongs. What type of field should pole1 have and how to make a selection...??

Answer the question

In order to leave comments, you need to log in

1 answer(s)
N
Nikolai Romanovich, 2017-02-26
@MikalaiR

As an option: create a unique identifier for each product, create a product_categories table in which to store the product id and category id, and do the selection something like this

select * from "product_categories" where "category_id"=100500;

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question