我可以SUM()
在ISNULL()
...内申请吗?考虑一下我下面的 sql server select 语句
SELECT e.Emp_Id,e.Identity_No,e.Emp_Name,case WHEN e.SalaryBasis=1
THEN 'Weekly' ELSE 'Monthly' end as SalaryBasis,e.FixedSalary,
ISNULL(Adv.Daily_Wage,0) as Advance from Employee as e
inner join Designation as d on e.Desig_Id=d.Desig_Id
Left Outer Join Payroll as Adv on e.Emp_Id=Adv.Emp_Id where e.Is_Deleted=0
该声明工作正常....但是当我SUM()
在ISNULL()
SELECT e.Emp_Id,e.Identity_No,e.Emp_Name,case WHEN e.SalaryBasis=1
THEN 'Weekly' ELSE 'Monthly' end as SalaryBasis,e.FixedSalary,
ISNULL(SUM(Adv.Daily_Wage),0) as Advance from Employee as e
inner join Designation as d on e.Desig_Id=d.Desig_Id
Left Outer Join Payroll as Adv on e.Emp_Id=Adv.Emp_Id
where e.Is_Deleted=0
我得到了错误,
列 'Employee.Emp_Id' 在选择列表中无效,因为它既不包含在聚合函数中,也不包含在 GROUP BY 子句中。
任何建议....