SELECT a.*, b.*, IF (b.eurosar = 1, ROUND(IF ((SELECT euroarfolyam FROM irodak WHERE iroda_id = a.iroda_id) > 0, (SELECT euroarfolyam FROM irodak WHERE iroda_id = a.iroda_id), 310.00) * b.ardecimal), b.ardecimal) AS euro_forint_iroda FROM idopont a, arak b WHERE a.ajanlat_id = '459008' AND a.idopont_id <> '1690268191' AND a.idopont_id = b.idopont_id AND a.idopont_status = 1 AND ( (a.idopont_szezonalis = 1 AND a.idopont_datum2 >= '2020-01-19') OR (a.idopont_szezonalis = 0 AND a.idopont_datum1 >= '2020-01-19') ) AND ( (a.idopont_arlejar > '0000-00-00' AND a.idopont_arlejar >= '2020-01-19') OR (a.idopont_arlejar = '0000-00-00') ) ORDER BY a.idopont_datum1, b.ardecimal LIMIT 0,3 / Server shutdown in progress