July 28, 2005 at 9:59 am
I've got a query with a few case in it which is fine.
What I'd like to do then is add these together but when use the case columns I get a error. Can this be done
Server: Msg 207, Level 16, State 3, Line 1
Invalid column name 'tc'.
July 28, 2005 at 10:03 am
select *,
case when contractretd = 0 then '-Terms & Conditions' else '' end TC,
case when letterretd = 0 then '-Offer Leter' else '' end let,
case when scheduleretd = 0 then '-Teaching Schedule' else '' end sc,
case when tc = '-Terms & Conditions'then [tc]+[let]+[sc]end ng
from chase_letter_bd_vw
July 28, 2005 at 10:03 am
could you please post the query ?!
**ASCII stupid question, get a stupid ANSI !!!**
July 28, 2005 at 10:18 am
oh - you're trying to concatenate the aliases....TC, let etc...that won't work...
don't have test data to test but try this:
select *,
case when contractretd = 0 then '-Terms & Conditions' else '' end TC,
case when letterretd = 0 then '-Offer Leter' else '' end let,
case when scheduleretd = 0 then '-Teaching Schedule' else '' end sc,
case when ((contractretd = 0) and (letterretd = 0) and (scheduleretd = 0)) then
'-Terms & Conditions -Offer Leter -Teaching Schedule' else '' end ng
from chase_letter_bd_vw
**ASCII stupid question, get a stupid ANSI !!!**
Viewing 4 posts - 1 through 3 (of 3 total)
You must be logged in to reply to this topic. Login to reply