select * from (
select
hai.PROC_INST_ID_ AS processInstanceId,
case when hai.ACT_NAME_ is null then
hai.ACT_TYPE_ else hai.ACT_NAME_
end AS currentActName
from act_hi_actinst hai
where hai.PROC_INST_ID_ in
<foreach collection="IdSet" index="index" item="item" separator="," open="(" close=")">
#{item}
</foreach>
and hai.TENANT_ID_ = #{tenantId}
and hai.`ACT_TYPE_`!= 'sequenceFlow'
having 1
order by hai.START_TIME_ desc, hai.END_TIME_ is null desc, hai.END_TIME_ desc, hai.`TRANSACTION_ORDER_` desc) t
GROUP BY processInstanceId
mysql分组查询 取最新一条数据
最新推荐文章于 2024-09-24 06:14:12 发布
这是一个关于SQL查询的博客,内容涉及从act_hi_actinst表中选取特定过程实例ID(PROC_INST_ID_)的相关信息。查询过滤了sequenceFlow类型的活动,并按START_TIME_降序和其他条件进行排序。博客主要讨论如何处理历史活动实例数据,特别是针对具有空ACT_NAME_的情况。
摘要由CSDN通过智能技术生成