我想在One表中查看这些细节。如何才能做到这一点..?

时间:2014-08-13 07:26:58

标签: sql sql-server sql-server-2008-r2

如何一起查看这两个表的所有细节(在EmpID上合并)?

第一张表是:

 SELECT [empid]
  ,[officeid]
  ,[desigindept]
  ,[apointdate]
  ,[joindtdept]
  ,[retdt]
  ,[basicpay]
  ,[logintobecreated]
  ,[SalarySlab]
  ,[ecode]
  ,[grad]
  ,[orderno]
  ,[flag]
  ,[Cadre]
  ,[type]
  ,[Appref]
  ,[otherstate]
  ,[otherReleInfo]
  ,[areaSelectionDate]
  ,[cadreAreaType]
  ,[pensionthrough]
  FROM [ACRM].[dbo].[EmpInfoProfessionalMaster] 

第二张表是:

SELECT [empid]
  ,[ecode]
  ,[Fname]
  ,[FHname]
  ,[mname]
  ,[lname]
  ,[dob]
  ,[sex]
  ,[ecast]
  ,[eimage]
  ,[relegion]
  ,[mstatus]
  ,[bloodgroup]
  ,[height]
  ,[idmark]
  ,[category]
  ,[hometown]
  ,[homestate]
  ,[nstation]
  ,[fingerprints]
  ,[lastOfficeId]
  ,[remarks]
  ,[flag]
  ,[DobAuth]
  ,[CasteAuth]
  ,[EmpSign]
  ,[PfAccountNo]
  ,[PANno]
  FROM [ACRM].[dbo].[EmpInfoPersonalMaster]

1 个答案:

答案 0 :(得分:1)

SELECT [empid]
      ,[officeid]
      ,[desigindept]
      ,[apointdate]
      ,[joindtdept]
      ,[retdt]
      ,[basicpay]
      ,[logintobecreated]
      ,[SalarySlab]
      ,[ecode]
      ,[grad]
      ,[orderno]
      ,[flag]
      ,[Cadre]
      ,[type]
      ,[Appref]
      ,[otherstate]
      ,[otherReleInfo]
      ,[areaSelectionDate]
      ,[cadreAreaType]
      ,[pensionthrough]
      ,[ecode]
      ,[Fname]
      ,[FHname]
      ,[mname]
      ,[lname]
      ,[dob]
      ,[sex]
      ,[ecast]
      ,[eimage]
      ,[relegion]
      ,[mstatus]
      ,[bloodgroup]
      ,[height]
      ,[idmark]
      ,[category]
      ,[hometown]
      ,[homestate]
      ,[nstation]
      ,[fingerprints]
      ,[lastOfficeId]
      ,[remarks]
      ,[flag]
      ,[DobAuth]
      ,[CasteAuth]
      ,[EmpSign]
      ,[PfAccountNo]
      ,[PANno]
  FROM [ACRM].[dbo].[EmpInfoProfessionalMaster]
  INNER JOIN [ACRM].[dbo].[EmpInfoPersonalMaster]
  ON [ACRM].[dbo].[EmpInfoProfessionalMaster].[empid]=[ACRM].[dbo].[EmpInfoPersonalMaster].[empid]