SQL Server数据库优化笔记
不定时更新
select DateDiff(month,'2018-06-07',GETDATE()) select DateDiff(month,( select TOP 1 PACTBEGINDATE from LEGAL_PACTSET_INFO where CUSTOMERID =1205 ORDER BY PACTBEGINDATE ASC),GETDATE()) select MIN(PACTBEGINDATE) from LEGAL_PACTSET_INFO where CUSTOMERID =104; SELECT top 1 PACTBEGINDATE FROM dbo.LEGAL_PACTSET_INFO WHERE CUSTOMERID=104 ORDER BY PACTBEGINDATE ASC