代码改变世界

group by 分组去重查询

2019-11-29 09:51  改改~_~  阅读(3065)  评论(0编辑  收藏  举报

数据库中的数据是这样的:

 

想要看看有几种类型,可以用group by:

  select * from activiti.act_ru_task 
 where PROC_INST_ID_ in (select PROC_INST_ID_ FROM activiti.act_ru_execution where BUSINESS_KEY_ in 
 (select  a.app_id from  bill_data.t_org_br_apply_info a left join user.t_user_info b on a.user_id=b.id where a.app_id in 
 (select b.app_id from bill_data.t_org_br_apply_person b  where 
b.tel_1 like '%15910383%' or
b.tel_1 like '%15910384%')))
 group by NAME_;