Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Using named columns in where clause

Status
Not open for further replies.
Sep 10, 2009
37
US
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
 
No, you can only use them in ORDER BY clause.

The work around may be you use your current select as a derived table.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top