Thursday, April 23, 2015

Get data for first date and last date

I have a table that capture the size of databases every week.

CREATE TABLE [dbo].[DBGrowthRate](
 [DBGrowthID] [int] IDENTITY(1,1) NOT NULL,
 [DBName] [varchar](100) NULL,
 [DBID] [int] NULL,
 [CurSize] [decimal](10, 2) NULL,
 [Gatherdate] [datetime] NULL,
 [Serversname] [varchar](50) NULL
) ON [PRIMARY]

What I want is to make a query that will return

DBName, Cursize (oldest Gatherdate, CurSize (most recent GatherDate, ServersName

I have no idea how to make this happen, I have tried working with Max and Min Gatherdate but that doesn't work.

Any ideas.

TIA,

Nancy


nlytle

No comments:

Post a Comment