sql - MySql count occurences of failure codes -
i trying count number of times happened failure status in database , retrieve name of failure. have table builds
holds failurearea
, table called failureareas
has names of failurearea codes. want able count these can graph out data , tell our devs how builds commonly fail.
this trying, isn't working:
select count(b.id), f.name builds b join failureareas f on b.failurearea = f.id date(b.submittime) >= date_sub(curdate(), interval 30 day) , b.buildstatus != 2
any great. thanks.
you need use group by:
select count(b.id), f.name builds b join failureareas f on b.failurearea = f.id date(b.submittime) >= date_sub(curdate(), interval 30 day) , b.buildstatus != 2 group f.name
Comments
Post a Comment