titans4771
MIS
Can you not use named columns in the where clause? Here is what I have:
Select
a.cancount, b.clientcount, sum(d.compcount) as compcount,
c.candidateid,
clientname,
firstname,
lastname,
cs.employmentcode,
'status' = case when a.cancount < (b.clientcount + sum(d.compcount)) then 'incomplete'
when a.cancount is null then 'incomplete'
ELSE 'complete' end,
'missingdocs' = Case when a.cancount < (b.clientcount + sum(d.compcount))
then (b.clientcount + sum(d.compcount))-a.cancount
when a.cancount is null
then (b.clientcount + sum(d.compcount))-a.cancount
else 0
end .............
where 'status' <> 'complete'
and it doesn't seem to be working
Select
a.cancount, b.clientcount, sum(d.compcount) as compcount,
c.candidateid,
clientname,
firstname,
lastname,
cs.employmentcode,
'status' = case when a.cancount < (b.clientcount + sum(d.compcount)) then 'incomplete'
when a.cancount is null then 'incomplete'
ELSE 'complete' end,
'missingdocs' = Case when a.cancount < (b.clientcount + sum(d.compcount))
then (b.clientcount + sum(d.compcount))-a.cancount
when a.cancount is null
then (b.clientcount + sum(d.compcount))-a.cancount
else 0
end .............
where 'status' <> 'complete'
and it doesn't seem to be working