Suppose that I have a table with the columns product_id
and category_id
, which sets the product to category. a product may have several categories.
let i have an array of id
-shnykh categories, for example, such - [1,2,3]
. the question is - how can I use the sql
query to display the product_id
only those products that belong to all three categories?
those. for example, if there are three lines 1-1
1-2
1-3
for a product with product_id
in the table, then we derive it.
SELECT * FROM table1 where product_id in (1,2,3)
? - HELO WORD