我在WHERE user_contact_info.master_admin = 1
中使用了$users_list1
,但是它不起作用。我也使用过AND user_contact_info.master_admin = 1
,但无法正常工作。 $users_list2
无需内部联接即可工作。如何修复$users_list1
sql?谢谢!
SQL 1
$users_list1 = $wpdb->get_results( "SELECT
user_contact_info.id,
user_contact_info.user_name,
user_contact_info.user_title,
user_contact_info.user_direct,
user_contact_info.user_mobile,
user_contact_info.user_mail_address,
user_contact_info.user_email,
user_contact_info.master_admin,
company_info.com_name
FROM user_contact_info
INNER JOIN company_info
ON user_contact_info.user_company = company_info.id WHERE user_contact_info.master_admin = 1
ORDER BY company_info.com_name ASC
limit $offset, $limit" );
SQL 2
$users_list2 = $wpdb->get_results( "SELECT * from user_contact_info WHERE master_admin = 1 ORDER BY user_name ASC limit $offset, $limit" )