create table images (id int, url varchar(100));
create table tags (id int, tag varchar(10));
create table image_tags (image_id int, tag_id int);
insert into images values (1, 'image_1'), (2, 'image_2'), (3, 'image_3');
insert into tags values (1, 'tag_a'), (2, 'tag_b');
insert into image_tags values (1,1),(2,2),(3,1),(3,2);
select
T.id, T.url from (select
images.id, images.url from images inner join image_tags on
images.id = image_tags.image_id inner join tags on
tags.id = image_tags.tag_id where tags.tag = 'tag_a') T inner join image_tags on
T.id = image_tags.image_id inner join tags on
tags.id = image_tags.tag_id where tags.tag = 'tag_b';