By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
460,044 Members | 1,172 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 460,044 IT Pros & Developers. It's quick & easy.

Trying to change my results in a query using case statement

P: 2
Hi. I have a fairly simple query and I need to change the name of the results in one field. I have a field called ' Org'. This field has three options. Conasp, Mexico and aspen. I have the following case statement but it won't work.

Case
When org = 'conasp' then ' Utica'
When org = ' aspen' then ' Denver'
When org = ' Mexico' then 'Mexico'

Else ' null'

End

Can someone help me? My query runs it just will not change the names. It uses the original names.

Thank you !!
Apr 24 '13 #1

✓ answered by vijay6

Hey Leftee08, you've to use like this,

Expand|Select|Wrap|Line Numbers
  1. CASE org
  2. WHEN 'conasp' THEN 'Utica'
  3. WHEN 'aspen' THEN 'Denver'
  4. WHEN 'Mexico' THEN 'Mexico'
  5. ELSE 'null'
  6. END

Share this Question
Share on Google+
3 Replies


100+
P: 158
Hey Leftee08, you've to use like this,

Expand|Select|Wrap|Line Numbers
  1. CASE org
  2. WHEN 'conasp' THEN 'Utica'
  3. WHEN 'aspen' THEN 'Denver'
  4. WHEN 'Mexico' THEN 'Mexico'
  5. ELSE 'null'
  6. END
Apr 24 '13 #2

P: 2
Thank you so much. It was driving me crazy. I knew it was something small like that. It works great now.
Apr 24 '13 #3

NeoPa
Expert Mod 15k+
P: 31,769
To understand the situation I can say that you could have just changed the first line to :
Expand|Select|Wrap|Line Numbers
  1. CASE TRUE
The code suggested in post #2 makes better sense in your situation though.

PS. I changed the title of the thread as the original gave a false idea of what the question was about.
Apr 28 '13 #4

Post your reply

Sign in to post your reply or Sign up for a free account.