sql 查出相同的记录 并把相同记录 显示在一起

select c.workunit unitname,a.positionid,a.positiontype,a.isfirst,a.mastersort,a.directoraudit, c.writername,d.bookname,e.orgname unitid,b.positiontype applypositiontype, b.auditstate,b.editauditstate,b.appposiid,c.writerid,d.bookid,b.materid,b.isreceivedpaper, case when a.positiontype='' or a.positiontype is null then 1 else 0 end sort from teach_positionset a right join teach_applyposition b on b.appposiid = a.appposiid left join writer_declaration c on c.writerid=b.writerid left join teach_bookinfo d on d.bookid=b.bookid left join ba_organize e on e.orgid=c.unitid where 1=1 and b.auditstate=11 and b.isreceivedpaper=1 and d.bookid="1815f93a80da4427853a1a2a9faf06e2"
AND b.positiontype in(SELECT b.positiontype applypositiontype FROM teach_applyposition b group by b.positiontype having count(b.positiontype)>1) GROUP BY appposiid ORDER BY sort,a.positiontype,a.mastersort,b.positiontype

SELECT b.positiontype applypositiontype FROM teach_applyposition b group by b.positiontype having count(b.positiontype)>1的结果是

 

转载于:https://www.cnblogs.com/niuxi/p/7244029.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值