linq to ef(相当于sql中in的用法)查询语句

时间:2014-08-17 18:21:12   收藏:0   阅读:1250

select * from DoctorInfo doctor
where doctor.HosDepartId in
(select Id from HospitalDepartment hd
where hd.DepartmentId=5)


var a=from d in _entity.HospitalDepartment
where d.DepartmentId==5
select d;

List<int> lst=new List<int>();
foreach(var b in a)
{
lst.add(b);
}

var doc=from c in _entity.DoctorInfo
where lst.contains(c.HospitalId)
select c;

linq to ef(相当于sql中in的用法)查询语句,布布扣,bubuko.com

原文:http://www.cnblogs.com/love828/p/3918031.html

评论(0
© 2014 bubuko.com 版权所有 - 联系我们:wmxa8@hotmail.com
打开技术之扣,分享程序人生!