A new bird to SQL.
Table A name is EmployeeDetails which has four columns.
EmployeeID FirstName, LastName, NativeState
1 Frank Dyre FL
2 John Smith AL
3 Taylor Cox GA
Table B is CompanyDetails which has three columns
CompanyID CompanyName HeadQuatersState
1 Steve's FL
2 Johnson NY
3 Huston GA
Now in both the tables there is no same columns. But Native State and HeadQuatersStat have common states.
how can I retrieve first and lastname of an employee from employeeDetails table where the nativestate is not equals to company headquarters state.
Expected result is John Smith.
I think this is what your looking for
SELECT EmployeeID,FirstName + ' ' + LastName 'Employee'
FROM EmployeeDetails
WHERE NativeState NOT IN (SELECT HeadQuartersState
FROM CompanyDetails)
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.