Hi,In simple terms I have a tablecomputerName, errorType, dateLoggedI want to get a count of No of errorType = 1 in the last 7 days for each different computerName.So I end up withCompName NoOfErrorsComputerA 27ComputerB 76ComputerC 2
I would do this using SELECT COUNT(*) FROM table WHERE computerName='ExampleComputer' AND errorType = 1 AND dateLogged > DATEADD(day,-7,getDate())
Great...Now my temptation is to load the list of computer names into a cursor and loop through replacing 'ExampleComputer' with my cursor output.Am I mad to rush in with a cursor is there a nicer more efficient and better way to do this without a cursor. I can't think of one but I hope it is my lack of knowladge I just have a gut feeling that a cursor is wrong in this instance!