SELECT `model`.* FROM `model` WHERE `model`.`id` IN (SELECT DISTINCT `tagRelation`.`modelId` FROM `tagRelation` WHERE `tagRelation`.`tagId` IN (1, 2, 3))
SELECT DISTINCT `tagRelation`.tagId
FROM `model`
INNER JOIN `tagRelation` ON `tagRelation`.`modelId` = `model`.id
WHERE 1
SELECT DISTINCT `tagRelation`.tagId
FROM `model`
INNER JOIN `tagRelation` ON `tagRelation`.`modelId` = `model`.id
WHERE `tagRelation`.`tagId` IN (1, 2, 3)