views:

39

answers:

0

The following code is what i used to identify the Top 10 earning items

var top = (from m in db.Stats
           where m.Item.AccountID == AccountID
           && m.DateTime >= month
           && m.DateTime < month.AddMonths(1)
           group m by m.Item into g
           orderby g.Sum(p => p.Earnings) descending
           select g.Key).Take(10).ToArray();

I need to identify which item has improved the most (%) when comparing 2 different months. The Data available is only daily totals. I might need to filter out items which are below a certain number of 'Visitors' i.e. where

m.Visitors >= 20

What is the best way to do this in Linq-Sql?