SQL Server based on date of birth, gender, age of identity, time to retire

Source: Internet
Author: User
Tags getdate

SELECT DBO.YGB.YGBM, DBO.YGB.YGXM, DBO.YGB.YGXB, Dbo.ygb.ygmz, Dbo.ygb.sfid, dbo.ygb.zzmm, DBO.YGB.YGSR,Year ( GETDATE ()) – Year (DBO.YGB.YGSR) as YGNL,
DBO.YGB.GZSJ,Case if ygxb = ' 1 ' then DATEDIFF (day, GETDATE (), DATEADD (year, year, YGSR)) When ygxb = ' 0 ' and yglb = ' cadre ' then DATED IFF (Day, GETDATE (),
DATEADD (year, year, YGSR)) When ygxb = ' 0 ' and yglb = ' worker ' then DATEDIFF (day, GETDATE (), DATEADD (year, all, YGSR)) END as Ntts,Dbo.ygb.byxx, DBO.YGB.YGXL,
DBO.XLB.XLMC, Dbo.ygb.ygzc, DBO.ZCB.ZCMC, Dbo.ygb.ygjn, DBO.JNB.JNMC, DBO.YGB.YGZW, DBO.ZWB.ZWMC, DBO.YGB.LXDH, DBO.YGB.GZGW, DBO.YGB.YGLB, Dbo.ygb.memo,
DBO.VW_YGQKB.QKMC, Dbo.vw_ygqkb.tqts, DBO.VW_YGQKB.SHJG
From Dbo.xlb INNER JOIN
DBO.YGB on dbo.xlb.xlbm = DBO.YGB.YGXL INNER JOIN
DBO.ZCB on dbo.ygb.ygzc = DBO.ZCB.ZCBM INNER JOIN
DBO.JNB on dbo.ygb.ygjn = DBO.JNB.JNBM INNER JOIN
DBO.ZWB on dbo.ygb.ygzw = DBO.ZWB.ZWBM left OUTER JOIN
DBO.VW_YGQKB on DBO.YGB.YGBM = DBO.VW_YGQKB.YGBM

SQL Server based on date of birth, gender, age of identity, time to retire

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.