mojahidm Posted February 26, 2019 Share Posted February 26, 2019 Hi Team, I'm currently working on trying to get number of services by request types I've got the following code: SELECT h_fk_servicename, SUM (CASE WHEN h_requesttype = 'Incident' THEN 1 ELSE 0 END) AS incident FROM h_itsm_requests WHERE h_datelogged between '19-01-01' AND '19-01-31' GROUP BY h_fk_servicename and when I run it I get the following error: I was wondering if you might be able to shed some light on this. I'm trying to see if I can get a count to work in a CASE statement. Many thanks, Mojahid Link to comment Share on other sites More sharing options...
HHH Posted February 26, 2019 Share Posted February 26, 2019 You managed to get a space between SUM and the initial bracket. Changing "SUM (" to "SUM(" should do it Link to comment Share on other sites More sharing options...
mojahidm Posted March 12, 2019 Author Share Posted March 12, 2019 Thanks Hans :-) Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now