Iif() sql statement is not working please help. An expression of non boolean type specified the context

the following sql is not working . If  sum(salary) = null   should be displayed  1 or 0
select empname,iif((isnull(sum(salary),0)),1,0) from salary group by empname
regards
Pol
polachan

I think what you're looking at is this
select e.empname,
COALESCE(s.totalsal,0) as salary
from employee e
left join (select empname,sum(salary) as totalsal
from salary
group by empname
)s
on s.empname = e.empname
where employee represents your master table containing employee information
Please Mark This As Answer if it helps to solve the issue Visakh ---------------------------- http://visakhm.blogspot.com/ https://www.facebook.com/VmBlogs

Similar Messages

Maybe you are looking for