p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 4 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 3 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 2 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 1 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM favorites_tasks l WHERE l.user_id = 1 AND l.task_id = p.id LIMIT 1) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 5 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 4 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 3 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 2 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
EXISTS(SELECT 0 FROM promo_tasks_bids b WHERE b.user_id = 1 AND b.status = 1 AND b.promo_id = p.id) AND p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
p.status = 3 AND (p.f_countries = 0 OR p.f_countries & 1) AND (p.f_referrer = 0 OR (p.f_referrer = 1 AND 0 = 0) OR (p.f_referrer = 2 AND p.user_id = 0)) AND (p.f_ratingof = 0 OR p.f_ratingof <= 505.00) AND (p.f_ratingto = 0 OR p.f_ratingto >= 505.00) AND (p.f_gender = 0 OR p.f_gender = 0) AND (p.f_work = 0 OR p.f_work = 0) AND (p.f_family = 0 OR p.f_family = 0) AND (p.f_ageof = 0 OR p.f_ageof <= 22) AND (p.f_ageto = 0 OR p.f_ageto >= 22) 
