Add Backup date to your SELECT clause _and_ your GROUP BY clause. SELECT count(1) as attempts, client, status, bkupdate FROM bpdjobs WHERE Status not in (0,1) GROUP BY bkupdate, status, client HAVING attempts >5
This will break your report down by date, then status, then client Shawn Green Database Administrator Unimin Corporation - Spruce Pine "Lewick, Taylor" <[EMAIL PROTECTED]> wrote on 09/16/2004 04:31:54 PM: > I have a mysql database/tables of information about netbackup jobs. I > would like to see a count of which clients are failing more than 5 times > (any status code other than 1 or 0) with the same error codes. > That was easy enough. > > The query... > select count(*) as 'attempts', client, status from bpdbjobs where > (status !=0 and status !=1) group by client having count(*) > 5 order by > status. > > This produced the following type of output. > > attempts | client | Status > 8 moe 13 > 6 win1 15 > > and so on... works great. And as long as I keep the time frame to less > than one day, no problem > But how would I go about breaking it down further to show me these by > date if I wanted to go back further in time? > > For instance if I write the same query but in the select clause I add > backup_date then I would like to see > > attempts | client | Status | Backup Date > 8 moe 13 2004-09-13 > 6 moe 13 2004-09-14 > > but I actually get > attempts | client | Status | Backup Date > 14 moe 13 2004-09-14 > > and it just assigns the latest backup date it saw for one of these > entries. Any ideas on how to write this query? > > Thanks all, and if there is a better list to pose query questions please > tell me which one it is. > Taylor > > -- > MySQL General Mailing List > For list archives: http://lists.mysql.com/mysql > To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED] >