c# - Execute multiple aggregates at once (SQL, LINQ).. or with better performance? -


I have a table with the record that contains a datetime column "CreationDate".

I need to get the following information for every for the last 90 days:

  • How many records were in total existence
  • How many records were added that day

I can definitely do this through a loop of counting, but this database will be killed 90 times ...

I am using C #, LINQ, SQL Server 2008.

are you looking for something like this? As with CTE (SELECT COUNT (*) over) (), Total Cost, CAST (Convert DateTime as VARCHAR, CreationDate, 101) as DateValue, * MyTable to WHERE CreationDate & gt; = DATEADD (DD, -90, GETDATE ())) DateValue, TotalCount, Order by date, as the line count from the CTE group by TotalCount;


Comments

Popular posts from this blog

c# - sqlDecimal to decimal clr stored procedure Unable to cast object of type 'System.Data.SqlTypes.SqlDecimal' to type 'System.IConvertible' -

Calling GetGUIThreadInfo from Outlook VBA -

Obfuscating Python code? -