Support » Plugin: WooCommerce » Need a mySQL query for Woo order info where billing name does not match shipping

  • Can anyone give me the MySQL query that would return post IDs for orders where the _billing_last_name and _billing_first_name DO NOT match the order’s _shipping_last_name and _shipping_first_name ?

    Thanks in advance.

Viewing 1 replies (of 1 total)
  • select ID
    from wp_posts p, wp_postmeta bfn, wp_postmeta bln, wp_postmeta sfn, wp_postmeta sln
    where p.ID = bfn.post_id
    and p.ID = bln.post_id
    and p.ID = sfn.post_id
    and p.ID = sln.post_id
    and bfn.meta_key = ‘_billing_first_name’
    and bln.meta_key = ‘_billing_last_name’
    and sfn.meta_key = ‘_shipping_first_name’
    and sln.meta_key = ‘_shipping_last_name’
    and bfn.meta_value != sfn.meta_value
    and bln.meta_value != sln.meta_value

Viewing 1 replies (of 1 total)
  • The topic ‘Need a mySQL query for Woo order info where billing name does not match shipping’ is closed to new replies.