• Resolved David

    (@birkvally)


    Hi.

    I get this DB error on my site now:

    Not unique table/alias: ‘wpu9_usermeta’1066

    SELECT SQL_CALC_FOUND_ROWS wpu9_users.ID
    FROM wpu9_users
    INNER JOIN wpu9_usermeta
    ON ( wpu9_users.ID = wpu9_usermeta.user_id )
    LEFT JOIN wpu9_usermeta
    ON wpu9_usermeta.user_id = wpu9_users.ID
    WHERE 1=1
    AND (user_login LIKE '%cost%'
    OR ID = 'cost'
    OR meta_value LIKE '%cost%')
    ORDER BY user_login ASC

    1. WP_User_Query->query()
      wp-includes/class-wp-user-query.php:844
    2. WP_User_Query->__construct()
      wp-includes/class-wp-user-query.php:80
    3. woo_add_customer_helper->get_users_created_by_plugin()
      wp-content/plugins/add-customer-for-woocommerce/include/tools/helper.php:795
    4. woo_add_customer_helper->is_customer_created_miss_match()
      wp-content/plugins/add-customer-for-woocommerce/include/tools/helper.php:775
    5. woo_add_customer_backend->wac_register_settings()
      wp-content/plugins/add-customer-for-woocommerce/include/classes/wac-backend.php:60
    6. do_action('admin_init')
      wp-includes/plugin.php:517

    Plugin: add-customer-for-woocommerce

    The page I need help with: [log in to see the link]

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author dansart

    (@dansart)

    Hi David

    Thanks for reaching out.
    The problem is, that there is a left join and an inner join which both using the same table.

    May plugin uses the WP_User_Query function to get the users. It looks like, another plugin filters the query. Are you using any other plugins, that might do something to the user query?

    A way to fix that, if you’re familiar with altering querys is, to use a alias.

    SELECT SQL_CALC_FOUND_ROWS wpu9_users.ID FROM wpu9_users
    INNER JOIN wpu9_usermeta AS um1
    ON ( wpu9_users.ID = um1.user_id )
    LEFT JOIN wpu9_usermeta AS um2
    ON um2.user_id = wpu9_users.ID
    WHERE 1=1 AND (user_login LIKE '%cost%' OR ID = 'cost' OR um1.meta_value LIKE '%cost%' OR um2.meta_value LIKE '%cost%')
    ORDER BY user_login ASC

    Let me know, if that helps

    Best, Daniel

    • This reply was modified 6 months, 3 weeks ago by dansart.
    Plugin Author dansart

    (@dansart)

    Hi @birkvally

    Since I got no feedback, I assume the issue is solved. Otherwise feel free to reach out again.

    Best, Daniel

Viewing 2 replies - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.