473,473 Members | 1,555 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Trying to change my results in a query using case statement

2 New Member
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
3 1453
vijay6
158 New Member
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
Leftee08
2 New Member
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
32,556 Recognized Expert Moderator MVP
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

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

Similar topics

7
by: chriskoch | last post by:
I am running a DTS Package. I have a temp table with 1494 records. I am inserting a 'Y' or 'N'into a temp table #HasClaims. The TempTable name with the Provider Id's(PRPR_ID) is...
12
by: rAinDeEr | last post by:
Hi, I have a table with 2 columns ** CREATE TABLE test (emp_num DECIMAL(7) NOT NULL,emp_name CHAR(10) NOT NULL) and i have inserted a number of records. ** Now, I want to insert a new...
3
by: catfan1 | last post by:
I am trying to extract data from two tables. I am trying to use a union to join the two tables so I can retrieve the information I need. Here is what I have so far but I get an error saying missing...
0
by: Deven Oza | last post by:
please help me to solve the query. (Using Case statements) Write PL/SQL code such that: the user will input a letter (A, B, C); the letter will refer to a case statement that will ask for...
1
by: 50gumbys | last post by:
I need to check a cell (eg A1) in Excel for: - the day of the month (date is entered as dd/mm/yy) - if the day is between 1 - 31, I want to go to the relevant cell (eg - B1 - B31) in order to enter...
1
by: ve01201 | last post by:
I am facing a peculiar problem when I use a case statement and a filter condition on the same column. The sql structure I use is as follows select case col1 when '1' then 'A' when '2' then...
2
by: elpeak | last post by:
I have a stored proc that contains 10 other stored procs. When i pass in the variable i want it to find the stored proc that matches and execute. I am having issues w/ the case statement and am...
2
by: pintu | last post by:
Hi Friends, I want to use "in" clause in case statement as shown below. e.g select * from employee where empid in case i_desgn when 'HR' then (1,2,3,4,5) when 'MD' then 1 else 7 end
1
by: themightyrhino | last post by:
I'm writing a process to perform multiple updates on a main table from information stored in different component reports. As you can see from the below, I'm using a select query to base the update...
2
by: Jacson | last post by:
Hello, I am trying to return multiple values as the CASE result embedded in a WHERE clause. This sample code, though it throws a syntax error, should give an idea what I am trying to accomplish....
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.