cachaito
1/16/2019 - 12:11 PM

Find Android version and count them

-- Example
-- '1', 'Mozilla/5.0 (Linux; Android 4.4.4; D5503 Build/14.4.A.0.157) AppleWebKit/537.36 (KHTML, like Gecko) Version/4.0 Chrome/33.0.0.0 Mobile Safari/537.36'

SELECT
  SUBSTRING_INDEX(
    SUBSTRING_INDEX(http_user_agent, 'Android ', -1),
      ';',
      1
  ) AS Android_ver,
  COUNT(*)
FROM taxijakt.wave_drivers
WHERE last_checkin >= '2018-01-01' AND http_user_agent LIKE '%Android%'
GROUP BY 1
ORDER BY 2 DESC;