当前位置: 动力学知识库 > 问答 > 编程问答 >

php - MySQL query to select multiple users

问题描述:

SELECT * FROM users LEFT JOIN (company_users) ON users.user_id=company_users.C_C_OWNER WHERE company_users.C_C_OWNER='19'

I get the following:

What I need to do is use the C_USER_ID field to select users in the user_id field under the users table. So far every way I try I get blank results. For example, there is a user 22 I want to grab.

网友答案:
SELECT * 
FROM users LEFT JOIN (company_users) 
ON users.user_id=company_users.C_USER_ID 
WHERE company_users.C_C_OWNER='19' 

Guess my coffee did not kick in yet. I just needed to change where my select query was pointing.

网友答案:
SELECT * FROM users ,company_users
WHERE users.user_id=company_users.C_C_OWNER 
AND company_users.C_C_USER_ID='22' 
分享给朋友:
您可能感兴趣的文章:
随机阅读: