如何使用$ wpdb查询从数据库中获得_customer_user_agent?
我尝试了这个,但是没有用:
global $wpdb;
$query = "
SELECT DISTINCT SUM(pm.meta_value)
FROM {$wpdb->prefix}posts as p
INNER JOIN {$wpdb->prefix}postmeta as pm ON p.ID = pm.post_id
WHERE p.post_type LIKE 'shop_order'
AND pm.meta_key LIKE '_customer_user_agent'
";
$dev_results = $wpdb->get_var($device_query);
$device_type = $dev_results;
我希望结果像这样: ipad-iphone-macintosh ...