我想获取数据两个表状态是活动但有查询不起作用

时间:2017-07-24 23:32:01

标签: sql

SELECT user.user_id,roles.roles_name,user.first_name,user.last_name,user.email,user.gender,user.password,
user.date_of_birth,user.image,user.home_town,user.status FROM USER INNER JOIN roles ON roles.roles_id = user.roles_id
AND STATUS = 1

2 个答案:

答案 0 :(得分:0)

SELECT 
user.user_id,
roles.roles_name,
user.first_name,
user.last_name,
user.email,
user.gender,
user.password,
user.date_of_birth,
user.image,
user.home_town,
user.status 
FROM USER 
INNER JOIN roles 
ON roles.roles_id = user.roles_id
AND user.STATUS = '1';

答案 1 :(得分:-2)

这是基本的连接查询:

select 
  *
from 
  TABLE_A
JOIN
  TABLE_B
ON
  TABLE_A.ID = TABLE_B.ID

按照上述规则更改您当前的查询,它应该可以正常工作