Hi,
I've no Mysql NG access from my ISP, so let me ask here.
I've a case statement in mysql.
Here is the code:
select ....,
case myvalue
when 'X' then valueX
when 'Y' then valueY
when 'A' then valueY
when 'B' then valueY
In my case, Y,A and B gave the same value.
I'm trying to do something like:
case myvalue
when 'X' then valueX
when in('Y','A','B') then valueY
But I can't get it to work with IN statement. What's the syntax ?
Bob 3 2758
Bob Bedford (be******@notforspammershotmail.com) decided we needed to
hear... Hi,
I've no Mysql NG access from my ISP, so let me ask here.
I've a case statement in mysql.
..... I'm trying to do something like:
case myvalue when 'X' then valueX when in('Y','A','B') then valueY
But I can't get it to work with IN statement. What's the syntax ?
Bob
select case when myvalue = 'X' then valueX
when myvalue in ('Y','A','B') then valueY else 'something'
If you don't supply the trailing else then null will be returned if
none of the conditions are satisfied.
--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address)
Dave (da**@REMOVEbundook.com) decided we needed to hear... Bob Bedford (be******@notforspammershotmail.com) decided we needed to hear... Hi,
I've no Mysql NG access from my ISP, so let me ask here.
I've a case statement in mysql. .... I'm trying to do something like:
case myvalue when 'X' then valueX when in('Y','A','B') then valueY
But I can't get it to work with IN statement. What's the syntax ?
Bob
select case when myvalue = 'X' then valueX when myvalue in ('Y','A','B') then valueY else 'something'
If you don't supply the trailing else then null will be returned if none of the conditions are satisfied.
My apologies - I'm missing an end from the statement...
select case when myvalue = 'X' then valueX
when myvalue in ('Y','A','B') then valueY else 'something' end
--
Dave <da**@REMOVEbundook.com>
(Remove REMOVE for email address) This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Dave |
last post by:
I am getting a syntax error on
Select Case Now
Case > "2/2/2004 12:30:00 AM"
response.redirect "votingover.asp"
case else
m=0
End Select
|
by: Kevin |
last post by:
Hi, I am getting a syntax error
Microsoft VBScript compilation error '800a03ea'
Syntax error
On the code below. The error references the "End Select" line
Can anyone help me with what I am...
|
by: Michael Hill |
last post by:
Is this a valid sql statement:
SELECT
case field1
when 'first' then 1
when 'second' then 1
else null
end
FROM mytable
|
by: Penny |
last post by:
Hi all,
My browser throws this Select Case block back at me pointing out a syntax
error on the line: 'Case < 251', between the word 'Case' and the '<' symbol.
***************************
...
|
by: Marco Lazzeri |
last post by:
What about a SELECT syntax like that?
SELECT
CASE WHEN bar.foo_id IS NULL THEN bar.*
ELSE foo.*
FROM foo, bar
Anyway, I need a SELECT query that gets data from a FIRST TABLE if a
specific...
| |
by: Benny Raymond |
last post by:
I'm confused as to how fallthrough is limited in switch. For example
the following works:
string switch_test = "a";
switch (switch_test)
{
case "a":
case "b":
case "c":
doSomething(a);
|
by: CJM |
last post by:
I'm getting a syntax error with a Select Case statement:
Select Case CSng(rs.fields("Field1"))
Case 0
Response.Write "Test1"
Case Is < 0 <<< Syntax Error...
|
by: enfuego |
last post by:
Hey kids, got a problem. Here's the code:
Rev.techCompany CASE WHEN techCompany LIKE 'North_IR' THEN 'NorthIR'
WHEN techCompany LIKE 'South_IR' THEN 'SouthIR'
WHEN techCompany LIKE...
|
by: arunmenon |
last post by:
Dear Folks,
I have an query which something looks like this
select ILTRDJ AS YEAR, DATEPART(MONTH,ILTRDJ) AS MONTH,
FMSTR.IMITM AS CODE,FMSTR.IMSRP6_UDC AS DESCRIPTION, FTRANS.ILDCT =
CASE...
|
by: Adem |
last post by:
C/C++ language proposal:
Change the 'case expression' from "integral constant-expression" to "integral expression"
The C++ Standard (ISO/IEC 14882, Second edition, 2003-10-15)
says under...
|
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,...
| |
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...
|
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...
|
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...
|
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: 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...
|
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...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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...
| |