Wednesday, October 14, 2009

Monday, September 7, 2009

How to group by in Linq

If you have a table[Table1] with columns[field1,field2] and you need just the uniqe rows for field1.
Your Ling query is just like

from t in contex.Table1
group t by t.field1 into g
select g.Key;

That's all.