,sum(case when name='绿茶' then 1 else 0 end)
as'绿茶'
,sum(case when name='黄茶' then 1 else 0 end) as '黄茶' from tablename
group by id给个思路你吧。先给表排列序号(类似ID来使用),然后写个循环,记录Failed次数,并且对比UUT_Staus值是否Failed,如果不为Failed,并且Failed大于1的,则把上一条记录插入到临时表中,最后再查找临时表。declare @ChongfuCount int,@TotalCount int
select @ChongfuCount=count() from
(select a2,count() as cnt from a group by a2 having count()>1) t
select @TotalCount =count(a2) from a
重复率 = @ChongfuCount10/@TotalCount
--但你说到分组 你把题目说的清晰点
select b1 from b,a
where aa1=ba1
group by b1
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)