select distinct p.id, p.*, partners.meno AS shop_name, partners.doprava AS delivery_cost from products_categories pc JOIN products p ON pc.product_id=p.id JOIN categories_new cn ON pc.category_id=cn.id INNER JOIN partners ON partners.id=p.shop JOIN (SELECT * FROM store where type = 'size' AND val_slug IN ('75c')) A1 ON (p.id = A1.product_id AND A1.type='size') WHERE p.state<>1 AND cn.slug = 'push-up-podprsenky' AND p.state=0 AND p.cena!=0 AND ( A1.val_slug='75c' )