SELECT
t1.item_code AS itemCode,
t1.rate,
t1.rate_time AS rateTime
FROM
t_item_main t1
INNER JOIN (
SELECT
SUBSTRING_INDEX(
group_concat(id ORDER BY created DESC),
',',
1
) AS id
FROM
t_item_main
GROUP BY
item_code
) t2 ON t1.id = t2.id
WHERE
t1.is_deleted = 0
AND t1.is_enable = 1
mysql 同一个id取创建时间最大的数据
最新推荐文章于 2022-09-29 18:26:57 发布