I am trying to count records in SQL Server. I have this Stored procedure but I am getting SQL errors.
Code:
Alter Procedure usp_rptQualityReport3 As
SELECT * FROM viewQualityReport
SELECT COUNT([FailureReason]) AS FC
WHERE
(((viewQualityReport.FailureReason) <> N'NONE'))
ORDER BY
FC
I am trying to count records that have like FailureReasons. I am selecting all the records from the view I created and then trying to count the records in the second Select statement. Basically what I want to do is counf them so I can then rank them starting with failure reasons that happen the most. I don't know what I am doing wrong.