select count(distinct p.products_id) as total from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id left join products_tags ptags on p.products_id = ptags.product_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ptags.tag_id = 'swimsuit' and (p.products_quantity > 0 or p.products_date_available >= (now() - interval 1 day)) and p.paypal_blocked = 0
select distinct p.products_quantity, p.products_date_available, p.products_image, m.manufacturers_id, p.products_id, pd.products_name, p.products_date_added, pd.products_subtitle, pd.products_subtitle, p.products_price, p.products_base_price, p.products_tax_class_id, if(s.status, s.specials_new_products_price, null) as specials_new_products_price, if(s.status, s.specials_new_products_price, p.products_price) as final_price from products p left join manufacturers m using(manufacturers_id) left join specials s on p.products_id = s.products_id left join products_tags ptags on p.products_id = ptags.product_id, products_description pd, categories c, products_to_categories p2c where p.products_status = '1' and p.products_id = pd.products_id and pd.language_id = '1' and p.products_id = p2c.products_id and p2c.categories_id = c.categories_id and ptags.tag_id = 'swimsuit' and (p.products_quantity > 0 or p.products_date_available >= (now() - interval 1 day)) and p.paypal_blocked = 0