我有2张桌子:

checkout

Userid | Checktime | Checktype | VERIFYCODE | SENSORID | Memoinfo | WorkCode | sn |

用户信息
Userid | Name | Gender

我只想从用户信息表中获取名称列,并将其插入到对应于其用户名checkinout.userid=userinfo.userid的 checkin 表中

以下是我的查询,但是我在userinfo周围遇到语法错误,您能说出我所缺少的内容吗?


SELECT checkinout.USERID, checkinout.CHECKTIME, checkinout.CHECKTYPE,checkinout.VERIFYCODE, checkinout.SENSORID, checkinout.Memoinfo, checkinout.WorkCode, checkinout.sn, userinfo.name
from bio_raw.checkinout, bio_raw.userinfo
join bio_raw.userinfo
on checkinout.userid = userinfo.userid

最佳答案

您不能混合使用explizit和implizit连接:

SELECT checkinout.USERID, checkinout.CHECKTIME, checkinout.CHECKTYPE,checkinout.VERIFYCODE, checkinout.SENSORID, checkinout.Memoinfo, checkinout.WorkCode, checkinout.sn, userinfo.name
   from bio_raw.checkinout
   join bio_raw.userinfo
   on checkinout.userid = userinfo.userid

10-07 15:54