Compare User meta_value with Product meta_value

In Wordpress I've added a new field called user_branche on the user edit profile page within the admin. On the Woocommerce product page in the admin I added a meta field called product_branche.

Now I need a database query to compare these. I only want to show the products with the same value for user_branche as product_branche.

I've spent some hours researching but I can't figure it out.

I tried using this:

SELECT t1.* from wp_postmeta t1 left outer join wp_usermeta t2 on t1.meta_value=t2.meta_value;

But that gives me a timeout and results in a phpmyadmin that is not working for several minutes.

Topic user-meta post-meta database query Wordpress

Category Web

About

Geeks Mental is a community that publishes articles and tutorials about Web, Android, Data Science, new techniques and Linux security.