SELECT
current_time_h,
current_time_c,
full_reg,
abs(
UNIX_TIMESTAMP( sync_date )- UNIX_TIMESTAMP( '2021-03-01 15:30:10' )) AS min ,sync_date
FROM
en_sync_airline_data
WHERE
full_reg = 'B-1062'
ORDER BY
min ASC
LIMIT 1;
说明: UNIX_TIMESTAMP --》 将时间转换为时间戳,abs---》绝对值,
两数相减取绝对值,然后排序,取第一条,