I have a List of Customers
List<Customers> cust = new List<Customers>(); cust.Add(new Customers(){ID=1, Name='Sam', PurchaseDate=DateTime.Parse('01/12/2008')}); cust.Add(new Customers(){ID=2, Name='Lolly' PurchaseDate=DateTime.Parse('03/18/2008')});
I want to show 2 seperate results like:
Purchases by Customer in Yr // Grouping by yr and display id,name
Purchases by Customer in Yr – Month // Grouping by yr then month and display id,name
Also What if i want to order the yr?
Update:
Just one more addition. If I have a field called ‘Status’ in the Customer class with either of these values ‘Y’, ‘N’, ‘C’ standing for yes, no and cancel how will i create a query to give ratio in %
Y – 20% N – 30% C – 50%
Grouping by year:
Grouping by year and month:
Ordering:
All of these use ‘dot notation’ instead of query expressions because they’re so simple – but you could use a query expression if you wanted to.
EDIT: For the status part, just use David B’s answer.