select tb_user.id, tb_user.user_name as userName, tb_user.user_pwd as userPwd, tb_user.user_gender as userGender, tb_role.role_name as roleName, from tb_user left join tb_role on tb_user.rid=tb_role.id;纠错
时间: 2023-08-07 08:02:33 浏览: 165
您的SQL查询语句有一个错误:在SELECT语句中,最后一个字段后面有一个逗号,应该将其删除。正确的查询语句如下:
```
SELECT tb_user.id, tb_user.user_name as userName, tb_user.user_pwd as userPwd, tb_user.user_gender as userGender, tb_role.role_name as roleName
FROM tb_user
LEFT JOIN tb_role
ON tb_user.rid=tb_role.id;
```
该查询语句将从`tb_user`表中选取`id`、`user_name`、`user_pwd`、`user_gender`四个字段,以及从`tb_role`表中选取`role_name`字段。使用LEFT JOIN将这两个表连接起来,连接条件是`tb_user.rid=tb_role.id`。
阅读全文