SELECT co.id, IFNULL( oe.follow_status, 'unFollow' ) AS followStatus, co.due_time FROM car_order co LEFT JOIN order_expire oe ON oe.order_id = co.id WHERE co.type = '贷款' AND co.STATUS = '已放款' AND co.approve_status != '结清成功' AND date_FORMAT( co.due_time, '%Y-%m-%d' ) <= '2022-10-29' ORDER BY field( oe.follow_status, 'unFollow', 'follow' ), co.due_time DESC, co.id DESC
日期排序錯誤。該怎麼寫呢?
假設
due_time
是時間戳列,您應該能夠直接將其與日期文字進行比較: