select
new.UniqueId,
task.Id,
task.Status,
task.saasEnv,
task.AppId,
task.CreateTime,
task.LastUpdateTime
from
(select
uniqueId,
count(id) as count,
group_concat(id order by id desc separator ',') as taskIdGroup
from xx.task
where id in (select taskId
from xx.task_bury_point_log
where code = '100803' and createTime > '2018-05-18 00:00:00')
group by BINARY UniqueId) as new, xx.task as task
where
CreateTime >= '2018-05-18 00:00:00' and BINARY task.UniqueId = new.UniqueId and find_in_set(task.id, new.taskIdGroup)
order by task.id desc;
纠结在没办法select id in group_concat(id order by id desc separator ',') ,搜索了下,总算找到个好用的办法。。
糟心
后来又发现,没设置区分大小写。只好再加上BINARY关键字。。
实际使用中发现,group_concat有数据量大小限制。。继续修改...