我的数据库如下:
优先级
ROLE_ID(pk) Department
---------------------------
1 Admin
2 Hr
3 Sales
此表是从Fat表中引用的:
Id Email ROLE_ID (FK)
-----------------------------------
1 abc@gmail.com 1
2 xyz@gmail.com 2
3 lmn@gmail.com 3
4 Jeams@gmail.com 3
5 ANder@gmail.com 3
当我尝试获取记录优先级(1)并且需要所有优先级(3)记录时
那我怎么知道He is Hr And He is Admin
Linq
public IEnumerable<Ems_UserFat_Tab> GetUserFatData()
{
var x = from n in db.EMS_USER_MASTER
join prio in db.Ems_priority_Master on n.USER_PRIORITY equals prio.User_Priority_ID
where n.ROLE_ID==3 && prio.User_Priority_ID==1
select new Ems_UserFat_Tab
{
Sh_Email= n.EMAIL,
};
return x.ToList();
}