SELECT b.* FROM brands AS b WHERE TRIM( b.brand ) != '' AND TRIM( b.brand ) != '#DELETE#' AND ( SELECT COUNT( * ) FROM phones AS p WHERE p.brands = b.dbId AND ( SELECT COUNT( * ) FROM phones_ref AS pr, merchants AS m WHERE pr.phones = p.dbId AND pr.merchants = m.dbId AND m.status = 'a' AND pr.status = 'a' AND ( pr.price != 0 OR pr.voucher != 0 ) AND m.locale = 2 ) > 0 ) > 0 ORDER BY b.brand;