Pergunta

How can I convert the following SQL select statement to 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

Any good reading references?

Foi útil?

Solução

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

Outras dicas

You can try this out http://www.sqltolinq.com/

Licenciado em: CC-BY-SA com atribuição
Não afiliado a StackOverflow
scroll top