It came down to SpiceWorks choking on the formatting of the query. the back ticks were removed from around column names, double quotes replaced with single quotes. Works as expected. Thank you all for your assistance. SELECT device_type , model , COUNT(CASE WHEN user_tag NOT LIKE '%decommissioned%' THEN 1 ELSE...
I think this is the right syntax: SELECT `device_type` AS Device, SUBSTR(`model`, 1, 30) AS Model, `location` AS "Location", (CASE WHEN `user_tag` LIKE "%decommissioned%" THEN "X" ELSE " " END) AS "Decom", count(`id`) AS "Count" FROM `devices` GROUP BY device_type, SUBSTR(`model`, 1, 30), location, (CASE WHEN `user_tag` LIKE "%decommissioned%" THEN...
regex,quantifiers,non-greedy,spiceworks
You can use this lookahead based regex to match first instance of the time matched by your regex: /^(?:(?!(?:0[1]|1[3-7]):\d\d:\d\d).)*((?:0[1]|1[3-7]):\d\d:\d\d)/m (?!...) is a negative lookahead that makes sure there is no other instance of time before matching a time thus matching only first instance. RegEx Demo...