TD查询相关语句

上一篇 / 下一篇  2011-12-30 10:35:02

研究了一下下,弄了3个sql大家可以用下,之后有需要可以继续研究哈。

 

1. 统计某个版本下所有reopen过的BUG:

   

select t.hs_key as 'TD号',count(t.hs_new_value) as 'reopen次数'  /*统计具体的TD号*/
from td.history t, td.bug t1
where t.hs_new_value = 'reopen' 
and t1.bg_bug_id=t.hs_key
and t1.bg_detection_version = 'V1.9'  /*版本号*/
group by t.hs_key
 
 
2. 统计某个版本下reopen过N次的BUG数:
 
select count(TD号)    /*统计个数*/
 from
   (select t.hs_key as 'TD号',count(t.hs_new_value) as 'reopen次数'
   from td.history t, td.bug t1
   where t.hs_new_value = 'reopen' 
   and t1.bg_bug_id=t.hs_key
   and t1.bg_detection_version = 'V1.7'  /*版本号*/
   group by t.hs_key) s
where  s.reopen次数= 'N'      /*N为你所需要统计的次数,如reopen过2次的,就写2*/

 

说明:统计出的结果你想要数量还是具体的TD号差别只是select后面带的参数不一样,后面的条件不变,可以根据需要换。

 

 

3. 每个BUG的修复时间:

select  BG_BUG_ID as 'TD号',DateDiff(d,bg_detection_date,bg_closing_date) as '处理时间(天)' , 
bg_responsible as '处理人' 
from td.bug  
where bg_detection_version = 'V1.9'
and bg_responsible <> 'xuey'
 
结果如图:   ,这样我们通过Excel导出,做成曲线图,就可以看出每个BUG修复所花费的时间变化(包含周末,这个没办法过滤)。可以提醒开发及时的修改BUG。不过这里有个问题,如图中有个值为null,这是因为这个TD指定给yuandd后,yuandd没有对这个TD做过任何操作,数据库里bg_closing_date的值为null造成的。类似的BUG不会多,可以手动过滤掉。或者可以研究下怎么取值。
 
 
我们关注的表主要有两张:td.bug  td.history  通过这两张表的组合,再通过Excel,基本本能满足我们所需要的统计数据,不仅限于TD自带的哟~

 


TAG:

chenkunlong的个人空间 引用 删除 chenkunlong   /   2012-04-01 17:15:28
数据导入至Excel后,可以用以下方法拆分数据:菜单——数据——分列——分隔符号——其他后面空格内输入*后点完成,
 

评分:0

我来说两句

日历

« 2024-05-15  
   1234
567891011
12131415161718
19202122232425
262728293031 

数据统计

  • 访问量: 16880
  • 日志数: 16
  • 文件数: 3
  • 建立时间: 2010-01-22
  • 更新时间: 2013-10-29

RSS订阅

Open Toolbar