IQueryable <int>不包含包含的定义

时间:2019-10-07 05:14:54

标签: c# linq-to-sql

我遇到了linq to sql的问题,我的sql查询是

  Select emp_name from employee where emp_manager_id in (Select emp_id  from employee where dept_id in 
                                                    (Select dept_id from department where dept_name='admin')
                                               )
                                               and emp_salary between
                                               (Select min_salary from salarygrades where grade='B')
                                               and 
                                               (Select max_Salary from salarygrades where grade='B')

我正在尝试将其转换为linq表达式,然后出现问题

var min_salary = from salarygrade in dbe.salarygrades where salarygrade.grade == "B" select salarygrade.min_Salary;
            var max_salary = from salarygrade in dbe.salarygrades where salarygrade.grade == "B" select salarygrade.max_Salary;
            var dept_id = from department in dbe.departments where department.dept_name.Contains("admin") select department.dept_id;
            var manager_id = from employee in dbe.employees where dept_id.Contains(employee.dept_id) select new { employee.emp_manager_id, employee.emp_id, employee.dept_id };


 var manager_id = from employee in dbe.employees where dept_id.Contains(employee.dept_id) select new { employee.emp_manager_id, employee.emp_id, employee.dept_id };

我得到的IQueryable<int>不包含Contains方法的定义

1 个答案:

答案 0 :(得分:0)