473,473 Members | 2,029 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

any one help me for the case of "case statement"

1 New Member
i use the case statement but it always show that an error near the case....

my usage is

select category =
case
when qtysold is 12 then 'sorry'
--when 'Band' then 'Wrist Band'
--when 'eyering' then 'eyring'
--when 'ear ring' then 'earring'
else qtysold
end
from mysales
Oct 11 '07 #1
2 1091
Jim Doherty
897 Recognized Expert Contributor
i use the case statement but it always show that an error near the case....

my usage is

select category =
case
when qtysold is 12 then 'sorry'
--when 'Band' then 'Wrist Band'
--when 'eyering' then 'eyring'
--when 'ear ring' then 'earring'
else qtysold
end
from mysales
try

when qtysold is = 12 then 'sorry'
Oct 11 '07 #2
iburyak
1,017 Recognized Expert Top Contributor
Try this:

Expand|Select|Wrap|Line Numbers
  1. select category = 
  2. case 
  3. when qtysold = 12 then 'sorry'
  4. --when ? = 'Band' then 'Wrist Band'
  5. --when ? = 'eyering' then 'eyring'
  6. --when ? = 'ear ring' then 'earring'
  7. else qtysold
  8. end
  9. from mysales
Oct 11 '07 #3

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

Similar topics

2
by: tedsuzman | last post by:
----- def f(): ret = 2 exec "ret += 10" return ret print f() ----- The above prints '12', as expected. However,
3
by: Hans-Dieter Franz | last post by:
Hello, I have a problem with a Java user-defined stored procedure and the "alter sequence" statement. I use DB2 8.1.2 and had the same problem with 8.1.0, but not with 7.*. I get the following...
5
by: charliewest | last post by:
I've implemented the USING statement to ensure that my newly created sql connection closes when my method is finished using it. The USING statement is wrapped in try/catch error handling statement....
7
by: Shapper | last post by:
Hello, I have a "Select Case MyVar" in which I define the values of an Array according to the value of MyVar. I need to use the Array Values in a Loop after End Select. It seems the Array is...
28
by: Steven Bethard | last post by:
Ok, I finally have a PEP number. Here's the most updated version of the "make" statement PEP. I'll be posting it shortly to python-dev. Thanks again for the previous discussion and suggestions!...
2
by: Dave Markle | last post by:
Good afternoon. I was just going through my code, analyzing it with FXCop, and FxCop gave me the following error on this code: MY CODE: Select Case termYears Case 5 : retVal.Append("1") Case...
4
by: Kevin Blount | last post by:
I've been unsuccessful finding a site that tells me, so I'm asking here: can I have multiple 'clauses' per 'case' in a 'switch' statement? e.g. switch "myVar" { case "1", "a": break;
9
by: Robbie Hatley | last post by:
Greetings, group. I just found a weird problem in a program where a variable declared in a {block} after a "case" keyword was being treated as having value 0 even though its actual value should...
13
by: Michael Bell | last post by:
Working my way through Koenig & Moo "Accelerated C++" and using Borlang Builder 5 (but that is probably not relevant) I reached exercise 1-1 and typed in #include <vcl.h> #pragma hdrstop...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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
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: 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 ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence...

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.