任何人都可以帮助我为下面的场景生成查询吗?
我有两个表TableA和TableB
TableA有以下列EMPLOYEEID,SKILLSETCODE,CERTID,LASTNAME,FIRSTNAME,MIDDLEINITIAL
TableB有两列EMPLOYEEID和key_user
我想选择EMPLOYEEID,SKILLSETCODE,CERTID,LASTNAME,FIRSTNAME,MIDDLEINITIAL来自TableA WHERE EMPLOYEEID =(从TableB中选择employeeid,其中key_user ='249')
如何为上述场景生成sql查询?
答案 0 :(得分:1)
使用联接。
SELECT TableA.EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL
FROM TableA, TableB
WHERE TableA.EMPLOYEEID = TableB.employeeid
and TableB.key_user='249'
答案 1 :(得分:0)
可替换地
SELECT TableA.EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL
FROM TableA
INNER JOIN TableB
ON TableA.EMPLOYEEID = TableB.employeeid
WHERE TableB.key_user='249'