The code here isn't for SQL Server - it looks like it might be for MySQL. This forum is for Microsoft SQL Server - you would probably get a better answer from a forum that is specific to your database product.
With that said...
Select Distinct $month_of_year
, sum(Case When status = 'success' Then 1 Else 0 End) As Success
, sum(Case When status Like '%fail%' Then 1 Else 0 End) As Failed
Where Action = 'login'
I would also recommend adding another column to show the total count - which would then include anything that isn't a 'success' or 'failure'. For example - completed, in progress, idle, waiting or any other status...
Problems are opportunities brilliantly disguised as insurmountable obstacles.
How to post questions to get better answers faster[/url]
Managing Transaction Logs[/url]