我在 TSQL 中有以下查询
select * from users
inner join linkUserPhoneNumber on users.UserId = linkUserPhoneNumber.UserId
INNER JOIN PhoneNumber ON PhoneNumber.PhoneNumberId =
linkUserPhoneNumber.PhoneNumberId
where UserName = 'superuser' and password ='password'
我在实体框架中有以下查询
var query = (from u in myEntities.Users
join link in myEntities.linkUserPhoneNumbers on u.UserId equals link.UserId
join p in myEntities.PhoneNumbers on p.PhoneNumberId equals link.PhoneNumberId
where u.UserName == Username && u.Password == Password
select u).ToList();
当我尝试编译它时,我得到
错误 3 名称 'p' 不在 'equals' 左侧的范围内。考虑交换 'equals' 两边的表达式。
错误 4 名称 'link' 不在 'equals' 右侧的范围内。考虑交换 'equals' 两边的表达式。