Hi I got in my database logs about users browser, and it shows, f.ex:
Firefox 6.0.2, Firefox 6.0.0
Chrome 14.0.835.163 and other versions….
and more
it’s all about version of browser. my question is it possible to do sql question where browser name is -> firefox (all versions), chrome(all version). And i need count them
Now I got something like this:
SELECT `logs`.`log_browser`, COUNT(*) AS `amount`
FROM `logs` GROUP BY `log_browser`
But it returns me Firefox 6.0.2 and Firefox 6.0.0 as different row
Is it possible? Or do I must do it in php with result?
How about something like this? This uses
LOCATEto find the first space, and will group by and return the left part of the browser name.See it in action
Schema
CREATE TABLE logs ( log_browser varchar(25)); INSERT INTO logs VALUES ('Firefox 6.0.2'), ('Firefox 6.0.0'), ('Chrome 14.0.835.163')Result