Not unique table/alias: 'tags_sets' sql failed:
SELECT banners.views_count, banners.s3_backet, banners.s3_content_key, banners.mask, banners.extension, banners.id as banner_id, banners.created as date, channels.ae_avs_id, sets.hash as set_hash FROM banners JOIN sets ON banners.set_id = sets.id JOIN channels ON channel_id = channels.id JOIN users ON channels.user_id = users.id JOIN tags_sets ON tags_sets.set_id = sets.id JOIN tags ON tags.id = tags_sets.tag_id AND tags.name LIKE '%bdsm%' JOIN tags_sets ON tags_sets.set_id = sets.id JOIN tags_categories ON tags_categories.tag_id = tags_sets.tag_id AND tags_categories.category_id IN (4) WHERE views_count < 10000 AND banners.width = 300 AND banners.height = 250 AND channels.is_deleted = 0 AND sets.status = 5 AND sets.is_deleted = 0 AND banners.is_deleted = 0 ORDER BY RAND() LIMIT 1