SELECT
aff.translationId,
aff.title,
aff.img_icon,
aff.img_icon2
FROM
all_filters_filters aff
WHERE
aff.lang = 'uk'
AND aff.pid = 2
AND EXISTS (
SELECT 1
FROM products_colors pc
JOIN all_filters_filters_items affi ON affi.pid = pc.pid_with
WHERE
pc.pid IN (102844, 288456, 276630, 276836)
AND affi.fid = aff.translationId
)
ORDER BY
aff.heading_contact ASC;
SELECT
aff.translationId,
aff.title,
aff.img_icon,
aff.img_icon2
FROM
all_filters_filters aff
WHERE
aff.lang = 'uk'
AND aff.pid = 3
AND EXISTS (
SELECT 1
FROM products_colors pc
JOIN all_filters_filters_items affi ON affi.pid = pc.pid_with
WHERE
pc.pid IN (102844, 288456, 276630, 276836)
AND affi.fid = aff.translationId
)
ORDER BY
aff.heading_contact ASC;
SELECT
aff.translationId,
aff.title,
aff.img_icon,
aff.img_icon2
FROM
all_filters_filters aff
WHERE
aff.lang = 'uk'
AND aff.pid = 1
AND EXISTS (
SELECT 1
FROM products_colors pc
JOIN all_filters_filters_items affi ON affi.pid = pc.pid_with
WHERE
pc.pid IN (102844, 288456, 276630, 276836)
AND affi.fid = aff.translationId
)
ORDER BY
aff.heading_contact ASC;
SELECT
aff.translationId,
aff.title,
aff.img_icon,
aff.img_icon2
FROM
all_filters_filters aff
WHERE
aff.lang = 'uk'
AND aff.pid = 39
AND EXISTS (
SELECT 1
FROM products_colors pc
JOIN all_filters_filters_items affi ON affi.pid = pc.pid_with
WHERE
pc.pid IN (102844, 288456, 276630, 276836)
AND affi.fid = aff.translationId
)
ORDER BY
aff.heading_contact ASC;