Answer the question
In order to leave comments, you need to log in
How to delete a record in a table, provided that the record belongs to two ids, and you need to delete the record with only one id?
Hello.
I had a "blunt" with such a seemingly simple question.
Please help.
There is a products_taxons table:
product_id | taxon_id
|
5 | 693
5 | 694
5 | 7
5 | 200
5 | 305
...
DELETE FROM products_taxons WHERE taxon_id = 693 AND taxon_id = 694 ;
Answer the question
In order to leave comments, you need to log in
DELETE FROM products_taxons WHERE taxon_id = 693 AND product_id IN (SELECT DISTINCT(product_id) FROM products_taxons taxon_id = 694)
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question