mysql子查询批量找id最大的
$sql = "select a.id as max_id,a.uid from
(
SELECT
`uid`,
id
FROM
(`users_level_change_log`)
WHERE
`uid` IN (
".$uids_str."
)
AND `level_type` = 2
AND `create_time` < '{$now_month}'
order by id desc ) as a group by a.uid";
$sql = "select a.id as max_id,a.uid from
(
SELECT
`uid`,
id
FROM
(`users_level_change_log`)
WHERE
`uid` IN (
".$uids_str."
)
AND `level_type` = 2
AND `create_time` < '{$now_month}'
order by id desc ) as a group by a.uid";