1

如何将以下 SQL 选择语句转换为 Linq?

SELECT u.Name FROM User u AS DDC
INNER JOIN Country c ON c.UserId = u.UserId
INNER JOIN (
     SELECT AddressId,
            Address, 
            PC, 
        FROM AddressTbl a
    WHERE a.CountryId = 1
) AS Addresses ON Addresses.AddressId= u.AddressId

WHERE 

u.UserIs = @UserId AND
Addresses.AddressId= @AddressId

有什么好的阅读参考吗?

4

2 回答 2

2
from u in Users join 
     c in Country on  c.UserId equals u.UserId
     join a in Address on a.AddressId equals u.AddressId     
where a.CountryId == 1
select u.Name
于 2012-01-06T13:07:43.087 回答
0

你可以试试这个 http://www.sqltolinq.com/

于 2012-01-06T13:04:05.187 回答