id int list_name string
id int list_name string item_name string price double qty int amt double
list_name ( Count)
public class MyListItem { public string category { get; set; } public double total { get; set; } } public List<mylistitem> jinal; public void listcountwise1() { var qur = from lst in db.List1 join it in db.Item1 on lst.List_name equals it.list_name group lst by new { lst.List_name } into g from c in g.DefaultIfEmpty() select new MyListItem() { category = g.Key.List_name, total = (c == null ? 0 : g.Count()) }; jinal = qur.ToList(); }
var q = from p in db.List1 join c in db.Item1 on p.List_name equals c.list_name into j1 from j2 in j1.DefaultIfEmpty() group j2 by p.List_name into g select new MyListItem() { category = g.Key, total = g.Count(t => t != null) }; it works...
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)