vgrabovets
10/6/2016 - 7:05 AM

devices

devices

CASE
WHEN o.`order_key` LIKE "kinomts%" THEN 'kinomts'
WHEN o.`order_key` LIKE "lifetv%" THEN 'lifetv'
WHEN o.`order_key` LIKE "intertelecom%" THEN 'intertelecom'
WHEN o.`order_key` LIKE "EC-%" THEN 'paypal'
WHEN
(o.`order_key` LIKE "android%" OR o.api_key LIKE "%android%") THEN 'android'
WHEN o.`order_key` LIKE "ios%" THEN 'ios'
WHEN (o.`order_key` LIKE "samsung%" OR o.api_key LIKE '%samsung%') THEN 'samsung'
WHEN (o.`order_key` = 'lg' OR o.api_key LIKE '%lg%') THEN 'lg'
WHEN (o.`order_key` = 'philips' OR o.api_key LIKE '%philips%') THEN 'philips'
WHEN (o.`order_key` = 'panasonic' OR o.api_key LIKE '%panasonic%') THEN 'panasonic'
WHEN (o.`order_key` = 'toshiba' OR o.api_key LIKE '%toshiba%' OR o.api_key LIKE '%aura%') THEN 'toshiba'
WHEN o.`order_key` = 'dune' THEN 'dune'
WHEN o.`order_key` = 'inext' THEN 'inext'
WHEN o.`order_key` = 'aura' THEN 'aura'
WHEN o.`order_key` = 'ErTelecom' THEN 'ErTelecom'
WHEN o.`order_key` = 'er_telecom' THEN 'ErTelecom'
WHEN o.`order_key` IN  ('_widows_phone','_windows_phone') THEN 'windows phone'
WHEN (o.`meta` LIKE "%sony%" OR o.`user_agent` LIKE "%sony%" OR o.`api_key` LIKE "%sony%") THEN 'sony'
ELSE 'other'
END AS orderkey,