score:0

Accepted answer
SELECT COUNT(*) AS [ProductCount], 
       SUM([t].[NewProduct]) AS [NewProductCount], 
       SUM([t].[UpdatedProduct]) AS [UpdatedProductCount]
FROM (
    SELECT [p].[Id], CASE
        WHEN [p].[CreatedAt] > @__Parse_0
        THEN 1 ELSE 0
    END AS [NewProduct], CASE
        WHEN [p].[UpdatedAt] > @__Parse_1
        THEN 1 ELSE 0
    END AS [UpdatedProduct], 1 AS [Key]
    FROM [Products] AS [p]
) AS [t]
GROUP BY [t].[Key]

score:0

var total = _db.Products.Count();
var NewProducts = _db.Products.Count(s => s.CreatedAt > crDate.Date);
var UpdatedProducts = _db.Products.Count(s => s.UpdatedAt > updDate.Date) ;


Related Query

More Query from same tag