473,395 Members | 2,798 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

How to get more than one filed in Case Statement

Hi All,

I am new to mysql, can any one help me to solve this problem,

i have a query, based on the condition i have to get two fields from the same table,
how to solve this problem,


select
(case
when hor_val>0 then hor_desc,hor_val
end) from temp

hor_val is a integer filed, hor_desc is a varchar field,

based on the har_val i have to get hor_desc and hor_val as output.

please give the solution, as earlier as possible.
Mar 21 '08 #1
3 1253
mwasif
802 Expert 512MB
please give the solution, as earlier as possible.
Here all the experts are volunteers. They reply in their free time.

Try the following code
Expand|Select|Wrap|Line Numbers
  1. SELECT CASE WHEN hor_val>0 THEN hor_desc ELSE hor_val END
  2. FROM temp
Mar 21 '08 #2
hi,

i tried ur code but i need to get the two fields if the value is greater the zero, not the single field.

so please solve the problems quickly
Mar 21 '08 #3
ronverdonk
4,258 Expert 4TB
please give the solution, as earlier as possible
so please solve the problems quickly
I really don't like remarks like these, looks more like demands.
And, as the previous poster already said, this forum is supported by volunteers helping out when and where they can and in their own time. Demanding things does not really help to get them enthusiastic for your problem.

Ronald
Mar 21 '08 #4

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

Similar topics

220
by: Brandon J. Van Every | last post by:
What's better about Ruby than Python? I'm sure there's something. What is it? This is not a troll. I'm language shopping and I want people's answers. I don't know beans about Ruby or have...
1
by: BO | last post by:
Hello, How we can change our cursor position for this issue: we are in Edit1 filed, when we click Enter (in Edit1 field) I want to be in Edit2 filed. How we can do it? Chris
116
by: Mike MacSween | last post by:
S**t for brains strikes again! Why did I do that? When I met the clients and at some point they vaguely asked whether eventually would it be possible to have some people who could read the data...
66
by: Mitchell S. Honnert | last post by:
In some recent posts, I've seen people who seem to be waxing nostalgic with respect to the "ease of use" of Visual Basic 6. I can't quite put my finger on it, but they seem to be implying that VB6...
5
by: serge | last post by:
Is it generally or almost always better to have multiple small SPs and functions to return a result set instead of using a single big 1000+ lines SP? I have one SP for example that is 1000+...
77
by: Peter Olcott | last post by:
http://www.tommti-systems.de/go.html?http://www.tommti-systems.de/main-Dateien/reviews/languages/benchmarks.html The above link shows that C# is 450% slower on something as simple as a nested loop....
4
by: jon.lewis | last post by:
I'm populating an unbound combo on a form as follows: Dim strRowSource As String Dim mydate As Date mydate = #1/1/2000# strRowSource = Format(mydate, "MMM YY") Do Until Format(mydate, "MMM...
3
by: Yas | last post by:
Hi everyone I am trying to create a DELETE Trigger. I have 2 tables. Table1 and Table2. Table 2 has all the same fields and records as Table1 + 1 extra column "date_removed" I would like that...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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,...

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.