【发布时间】:2010-02-23 07:41:47
【问题描述】:
我可以在ISNULL() 中应用SUM().... 考虑我下面的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
此声明工作正常....但是当我在 ISNULL() 中应用 SUM() 时
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 子句。
任何建议....
【问题讨论】:
标签: sql-server-2005 select sum isnull