SELECT * FROM ham01 CREATE TABLE TDatabaseInfo ( ) CREATE TABLE TEmployeeInfo ( FCompName VARCHAR(50), FEmpNo VARCHAR(50), FEmpName VARCHAR(50), FMobile VARCHAR(50), FPosName VARCHAR(50) ) SELECT gae02c AS FCompName ,haa01c AS FEmpNo,haa02c AS FEmpName,haa20c AS FMobile,gsb03c AS FPosName FROM ham01 LEFT JOIN gam05 ON haa00c = gae01c LEFT JOIN gsm02 ON haa25c = gsb02c AND gsb01c = 'R' WHERE haa20c IS NOT NULL AND len(haa20c) = 11 GROUP BY gae02c,haa01c,haa02c,haa20c,gsb03c