I have two tables: photos (id,path)and tags(id,name). Tables are, in many ways, so I have a third table:
photos_tags(photos_id, tags_id).
Now, how can I associate a photo of a specified path with a tag of a specified name? I would like to do something like this:
INSERT INTO photos_tags
SELECT photos.id, tags.id FROM photos, tags
WHERE photos.path = '/some/path' AND tags.name = 'tag';
source
share