SELECT jmA.jm_jarat_id AS ja_id, jmA.jm_indulas AS start_ido, jmB.jm_erkezes AS stop_ido, jmA.jm_id AS start_id, jmB.jm_id AS stop_id, (TIME_TO_SEC(jmB.jm_erkezes) + (86400 * jmB.jm_nap)) - (TIME_TO_SEC(jmA.jm_indulas) + (86400 * jmA.jm_nap)) AS menetido, '0' AS tipus, '2019-03-27' AS datum FROM jaratok_megallok AS jmA INNER JOIN (SELECT temp.jm_id, temp.jm_jarat_id, temp.jm_allomas_hu, temp.jm_nap, temp.jm_erkezes, temp.jm_orszag, temp.jm_varos FROM jaratok_megallok AS temp WHERE temp.jm_varos = '15' ORDER BY temp.jm_nap DESC, temp.jm_erkezes DESC) AS jmB ON jmA.jm_jarat_id = jmB.jm_jarat_id INNER JOIN jaratok AS j ON(j.ja_id = jmA.jm_jarat_id AND j.ja_aktiv = 1 AND j.ja_accepted = 1) WHERE jmA.jm_varos = '103068' AND jmB.jm_varos = '15' AND (TIME_TO_SEC(jmA.jm_indulas) + (86400 * jmA.jm_nap)) < (TIME_TO_SEC(jmB.jm_erkezes) + (86400 * jmB.jm_nap)) AND (TIME_TO_SEC(jmA.jm_indulas) >= TIME_TO_SEC('00:00')) AND ( (jmA.jm_orszag = jmB.jm_orszag AND (SELECT ja_jarat_tipus FROM jaratok WHERE ja_id = jmA.jm_jarat_id) IN('belföld', 'vasut') ) OR (jmA.jm_orszag != jmB.jm_orszag AND (SELECT ja_jarat_tipus FROM jaratok WHERE ja_id = jmA.jm_jarat_id) IN('külföld', 'vasut') ) ) AND ja_accepted = 1 AND ja_aktiv = 1 AND ja_jarat_tipus IN('belföld','külföld','vasut') AND IF(ja_type = 1, '2019-03-27' BETWEEN ja_aktiv_start AND ja_aktiv_stop, ja_passziv_periodus IN(18,20,24,26,28,29,30,32,34,35,36,37,38,41,44,46,50,52,53,55,56,57,58,59,60,61,62,65,66,67,68)) AND IF((TIMESTAMPDIFF(DAY, CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2)), CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2)))) = -1, 1, IF( TIMESTAMP(CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2))) > TIMESTAMP(CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2))), (DAYOFYEAR('2019-03-27') BETWEEN 1 AND LEAST(DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2))), DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2)))) OR DAYOFYEAR('2019-03-27') BETWEEN GREATEST(DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2))), DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2)))) AND 366), DAYOFYEAR('2019-03-27') BETWEEN LEAST(DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2))), DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2)))) AND GREATEST(DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_start, '-', -2))), DAYOFYEAR(CONCAT('2019-', SUBSTRING_INDEX(ja_stop, '-', -2)))) )) AND ((CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(9)\\+') OR (CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(3)\\+') OR (CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(43)\\+') OR (CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(0)\\+') OR (CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(8|63)\\+' AND NOT CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(16)\\+') OR (CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(10|73)\\+' AND NOT CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(17)\\+') OR ja_knapok = 51 OR ja_knapok = 52 OR ja_knapok = 53 OR ja_knapok = 54) AND IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(8)\\+', IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(43|63|3|0)\\+' OR ja_knapok = 8, 1, 0 ), IF( NOT CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(16)\\+', 1, 0 ) ) AND IF( `ja_knapok` = '31', 0, 1 ) AND IF( `ja_knapok` = '32', 1, 1 ) AND IF( `ja_knapok` = '33', 1, 1 ) AND IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(10)\\+', IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(43|73|3|0)\\+' OR ja_knapok = 10, 1, 0 ), IF( NOT CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(17)\\+', 1, 0 ) ) AND IF( `ja_knapok` = '34', 0, 1 ) AND IF( `ja_knapok` = '35', 1, 1 ) AND IF( `ja_knapok` = '36', 1, 1 ) AND IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(51|52)\\+', IF ( CONCAT('+', j.ja_knapok, '+') LIKE '%+52+%', DATEDIFF('2019-03-27', CONCAT_WS('-', '2019', SUBSTRING_INDEX(IF(ja_type = 1, j.ja_aktiv_start, j.ja_start), '-', -2))) % 2 != 0, DATEDIFF('2019-03-27', CONCAT_WS('-', '2019', SUBSTRING_INDEX(IF(ja_type = 1, j.ja_aktiv_start, j.ja_start), '-', -2))) % 2 = 0 ), 1 ) AND IF( CONCAT('+', `ja_knapok`, '+') REGEXP '\\+(53|54)\\+', IF ( CONCAT('+', j.ja_knapok, '+') LIKE '%+54+%', DATEDIFF('2019-03-27', CONCAT_WS('-', '2019', '06-01')) % 2 != 0, DATEDIFF('2019-03-27', CONCAT_WS('-', '2019', '06-01')) % 2 = 0 ), 1 ) GROUP BY jmA.jm_jarat_id ORDER BY jmA.jm_indulas ASC, menetido DESC
126: Incorrect key file for table '/tmp/#sql_1e96_5.MYI'; try to repair it