select f.name as filter_name,pg.name as group_name from filters as f join filters_products_group as fpg on f.id = fpg.filters_id join products_group as pg on fpg.products_group_id = pg.id
SELECT
CASE
WHEN (GROUP_CONCAT(f.name SEPARATOR '|||') LIKE '%|||%') THEN
NULL
ELSE
f.name
END AS filter_name,
pg.name AS group_name
FROM
filters AS f
JOIN filters_products_group AS fpg ON f.id = fpg.filters_id
JOIN products_group AS pg ON fpg.products_group_id = pg.id
GROUP BY f.name