SELECT oferty.OFFER_ID,t.tow_kod,( case when (t.CE_BAZ_WAL* 1.381973<1) THEN 1 ELSE round(t.CE_BAZ_WAL* 138.1972)/100 END) AS min,t.CE_BAZ_WAL*10 AS max FROM mp_offer oferty JOIN tow t ON oferty.TOW_KOD = t.tow_kod WHERE STATUS IN ('ACTIVE') AND oferty.ACCOUNTID = '0000000002' AND oferty.tow_kod not IN (SELECT tow_kod FROM kpl_def) GROUP BY tow_kod ORDER BY 2 ASC