make brick_type_filter SQL work with mysql