在一条语句中从前两个日期获取值的最有效方法是什么?(Freespace-2 和 free space -3 将提前 2 天和 3 天)
SELECT
servername,
DriveName,
DriveLabel,
TotalCapacity,
UsedCapacity,
FreeSpace,
FreeSpacePercentage,
'' AS [Freespace -2],
'' AS [Frespace-3], logDate
FROM dba.DiskSpace
WHERE logDate>GETDATE()-1;
CREATE TABLE [dba].[DiskSpace](
[servername] [varchar](100) NULL,
[DriveName] [varchar](3) NULL,
[DriveLabel] [varchar](100) NULL,
[TotalCapacity] [decimal](10, 2) NULL,
[UsedCapacity] [decimal](10, 2) NULL,
[FreeSpace] [decimal](10, 2) NULL,
[FreeSpacePercentage] [int] NULL,
[logDate] [date] NULL
) ON [PRIMARY]
GO