SELECT `A`.`*` FROM `tablename` AS `A`, ( SELECT `code`, MAX(`date`) AS `max_date` FROM `tablename` GROUP BY `code` ) AS `B` WHERE `A`.`code` = `B`.`code` AND `A`.`date` = `B`.`max_date`;
Copyright © 2024 码农人生. All Rights Reserved