SELECT DISTINCT p.products_id, p.products_price_tax, pd.products_name, cu.value, cu.currencies_marza, (p.products_price_tax/cu.value)+(cu.value*cu.currencies_marza/100) AS cena
FROM products p
LEFT JOIN currencies cu ON cu.currencies_id = p.products_currencies_id
LEFT JOIN products_to_categories ptc ON ptc.products_id = p.products_id
LEFT JOIN products_description pd ON pd.products_id = p.products_id AND pd.language_id = '2'
WHERE ptc.categories_id in (17,85,305,303,307,304,310,308,309,315,313,314,316,89,335,334,331,81,286,285,283,282,284,94,356,358,359,360,361,86,72,190,193,187,191,189,188,656,654,655,198,1027,1026,186,185,184,200,192,197,194,196,199,195,74,213,214,216,211,212,215,217,82,291,289,290,77,237,240,243,231,241,242,235,239,244,76,226,227,230,223,224,225,229,228,73,204,205,206,209,207,208,202,80,269,270,280,1028,265,272,281,266,271,277,268,276,279,278,274,93,351,352,70,90,338,339,340,95,368,371,364,372,378,365,369,370,373,379,366,377,380,87,323,321,322,84,302,301,298,299,300,79,262,263,257,259,261,258,264,88,326,327,329,324,325,328,91,341,342,83,296,295,293,294,297,71,181,180,178,179,92,350,345,346,349,75,220,221,218,219,222,96) AND
p.products_status = '1' and p.listing_status = '0' and ( (p.customers_group_id = '0' or p.customers_group_id = '' ) )
ORDER BY p.sort_order desc, pd.products_name LIMIT 0,24