Type of the subquery is not important, emptiness of t3 also is not important.
A bit simplified query:
SELECT COUNT(DISTINCT t2.b), CONCAT(t1.c)
FROM t1, t2
WHERE (t2.c = t1.c)
AND (
t1.b = 4
OR t1.a = 137
AND (SELECT a FROM t3 )
)
GROUP BY 2;
drop tables t1,t2,t3;
Type of the subquery is not important, emptiness of t3 also is not important.
A bit simplified query:
SELECT COUNT(DISTINCT t2.b), CONCAT(t1.c)
FROM t1, t2
WHERE (t2.c = t1.c)
AND (
t1.b = 4
OR t1.a = 137
AND (SELECT a FROM t3 )
)
GROUP BY 2;
drop tables t1,t2,t3;