/****** Script for SelectTopNRows command from SSMS ******/

/* Script for SelectTopNRows command from SSMS */

SELECT [DWBM]
      ,[RYXH]  
      ,[XM]
      ,[BMBM]
      ,[SFZH]
  FROM GZ_RY_JBXX  
  AS A
  where (SFZH in (select SFZH from GZ_RY_JBXX AS B where B.RYBM<>A.RYBM))
  order by SFZH


这是查出整个库中所有在职试用期人员
select
  d.DWBM,d.DWMC,r.RYXH,r.XM,r.SFZH,'' JCJG
  from GZ_DW_DWXX d
  join GZ_RY_JBXX r on r.DWBM=d.DWBM
  and r.RYZT in('01','02')

你可能感兴趣的:(数据库)