WooCommerce使用wpdb查询获取customer_user_agent

时间:2018-11-10 02:50:26

标签: wordpress woocommerce

如何使用$ 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 ...

0 个答案:

没有答案