Question: can any one help me in generating query for the below scenario?

i have twop tables TableA and TableB

TableA has teh follwing columns EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL

TableB has two columns EMPLOYEEID and key\_user

i want to SELECT EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL FROM TableA WHERE EMPLOYEEID = (select employeeid from TableB where key\_user='249')

how can i generate a sql query for the above scenario?

Answer: 
Use a join.

```
SELECT TableA.EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL 
FROM TableA, TableB
WHERE TableA.EMPLOYEEID = TableB.employeeid 
and TableB.key_user='249'

```
Alternately

```
SELECT TableA.EMPLOYEEID, SKILLSETCODE,CERTID, LASTNAME, FIRSTNAME, MIDDLEINITIAL 
FROM TableA
  INNER JOIN TableB
    ON TableA.EMPLOYEEID = TableB.employeeid 
WHERE TableB.key_user='249'

```