MySql queried two fields and compared them in the where condition. One of the fields could not be read.

SELECT a.something,a.time1,a.time2 FROM `table` AS a WHERE a.time1 < (a.time2 * 60 + 3600);

in this case, it is impossible to recognize whether there is any good method for time2, during the calculation.

Mar.03,2021

SELECT a.id.time1 FROM table as a LEFT JOIN (
SELECT id,time2 FROM table
) as b on b.id=a.id WHERE a.time1 < (b.time2*60+3600)


SELECT a.something,a.time1,a.time2 FROM `table` AS a having a.time1 < (a.time2 * 60 + 3600);
Menu