Answer the question
In order to leave comments, you need to log in
SQL insert a column from another table, how to write a condition?
Hello.
I have 2 tables
One is called images
Another products
The task is to transfer the url column (links to the image) from the images table to the products table in the (images) field in the picture it is not visible.
But you need to transfer with the condition that images.object_id be equal to products.id and images.object = "product"
I try to do this:
SELECT url, object_id FROM images INNER JOIN products ON images.object_id = products.id AND images.object = "product"
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question