dwalby Posted December 15, 2017 Share Posted December 15, 2017 Hi all, I'm trying to create a widget counter for 'Number of Incidents Resolved Today' and 'Number of Service Requests Resolved Today'. I can't quite figure out why both widgets are showing the same figure though, see below queries: Service Request Link to comment Share on other sites More sharing options...
Victor Posted December 15, 2017 Share Posted December 15, 2017 @dwalby because how the logical operator precedence works... you would need to put h_status = ... OR h_status = ... within brackets... or use this instead: h_status IN (''status.resolved', 'status.closed') EDIT: you don't need the second brackets... to be more clear your queries would need to be these: For Incidents: (h_status = 'status.resolved' OR h_status = 'status.closed') AND h_dateresolved = current_date AND h_requesttype = 'Incident' For Service Requests: (h_status = 'status.resolved' OR h_status = 'status.closed') AND h_dateresolved = current_date AND h_requesttype = 'Service Request' As mentioned above, for the status you can use this criterion as well (which removes the need for any bracket between logical operators): h_status IN ('status.resolved', 'status.closed') AND h_dateresolved = current_date AND h_requesttype = '...' Link to comment Share on other sites More sharing options...
dwalby Posted December 15, 2017 Author Share Posted December 15, 2017 Thanks @Victor - although both counters are now showing 0 now, which isn't correct. Is the h_dateresolved query correct? Link to comment Share on other sites More sharing options...
Victor Posted December 15, 2017 Share Posted December 15, 2017 @dwalby try this for the resolved date: h_status IN ('status.resolved', 'status.closed') AND DAY(h_dateresolved) = DAY(NOW()) AND MONTH(h_dateresolved) = MONTH(NOW()) AND YEAR(h_dateresolved) = YEAR(NOW()) AND h_requesttype = '...' because we store date and time and you only need the date... 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