I am studying that Linq to DataTable,Lambda. Because is difficult want to change sql to linq,Lambda, is not doing.
Below the SQL code is member list that remove telephone number repetition. I will thank if help.
SELECT A.no, B.name, B.userId, B.homeTel2
FROM
( SELECT homeTel2, min(no) NO
FROM OF_Mem开发者_如何学Pythonber
GROUP BY homeTel2
) A
INNER JOIN OF_Member B
ON A.NO = B.NO
Progressing work ============
var objectName =from t in mMemberTable.AsEnumerable()
group t by t.Field("homeTel2")Try this link:
Linq to Entities simple group query
converting ms sql “group by” query to linq to sql
var objectName =from t in mMemberTable.AsEnumerable()
group t by t.Field<string>("homeTel2") into groups
select groups;
Hope this helps,
Regards
Try using a tool called LINQ Pad. This is the best tool so far for writing and testing sql/LINQ queries and moreover it is free. It also allows you to convert your queries from LINQ to SQL and vice-versa.
http://www.linqpad.net
精彩评论