开发者

converting a SQL statement to LINQ query on a DataTable

开发者 https://www.devze.com 2023-02-08 18:06 出处:网络
I am studying that Linq to DataTable,Lambda. Because is difficult want to change sql to linq,Lambda, is not doing.

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

0

精彩评论

暂无评论...
验证码 换一张
取 消