At 12:40 -0800 3/9/05, Homam S.A. wrote:
Thanks Tom, Daniel, and Philippe for you replies.
Yes, I got the statement working exactly as I wrote
it. I was confused about this documentation:
http://dev.mysql.com/doc/mysql/en/case-statement.html
which states that you need to specify "END CASE"
instead
Thanks Tom, Daniel, and Philippe for you replies.
Yes, I got the statement working exactly as I wrote
it. I was confused about this documentation:
http://dev.mysql.com/doc/mysql/en/case-statement.html
which states that you need to specify "END CASE"
instead of just "END". So I used the same synt
On Wednesday, March 09, 2005 07:49, Philippe Poelvoorde wrote:
> Daniel Kasak wrote:
>> Homam S.A. wrote:
>>
>>> In the documentation, it doesn't mention which version
>>> of MySQL supports the CASE statement, but it refers to
>>> stored procedures, so is it only supported for 5.x?
>>>
>>> I ca
Daniel Kasak wrote:
Homam S.A. wrote:
In the documentation, it doesn't mention which version
of MySQL supports the CASE statement, but it refers to
stored procedures, so is it only supported for 5.x?
I can't get any example of a CASE statement work in
MySQL.
For example, I can execute the follo
Homam S.A. wrote:
In the documentation, it doesn't mention which version
of MySQL supports the CASE statement, but it refers to
stored procedures, so is it only supported for 5.x?
I can't get any example of a CASE statement work in
MySQL.
For example, I can execute the following in MS SQL
Serve
7;NA', 'NG', 'RA')
END as action
FROM master_info WHERE
(( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR
( status IN ( 'NA', 'NG', 'RA' )));
- Original Message -
From: "Mojtaba Faridzad" <[E
> I didn't have your table so I tried to write the same command by one of my
> tables. my query which worked, is:
> SELECT CASE WHEN left( workorder, 1 )
> IN ( 'C', 'T' )
> THEN 'group1'
> WHEN left( workorder, 1 )
> IN ( '3', 'R' )
> THEN 'gorup2'
> ELSE
> 'group3'
> END FROM workfile;
7;gorup2'
ELSE
'group3'
END FROM workfile;
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "Mojtaba Faridzad" <[EMAIL PROTECTED]>; "MySQL"
<[EMAIL PROTECTED]>
Sent: Friday, October 24, 2003 3:34 PM
Subject: Re:
> SELECT
> CASE WHEN status IN('BR', 'VQ', 'RQ', 'NG' )
> THEN
> 'binding'
> CASE WHEN status IN('NA', 'NG', 'RA')
> END as action
> FROM master_info WHERE
> (( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR
> ( status IN ( 'NA', 'NG', 'RA' )));
Sadly, that didn't work:
Your MySQL connection id is 2085
SELECT
CASE WHEN status IN('BR', 'VQ', 'RQ', 'NG' )
THEN
'binding'
CASE WHEN status IN('NA', 'NG', 'RA')
END as action
FROM master_info WHERE
(( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR
( status IN ( 'NA', 'NG', 'RA' )));
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "
That's also right:
select sum( case 1 when score=7 then score * 2 else score end) from "foo";
[EMAIL PROTECTED] on 03/07/2003
11:28:03 AM
To: Peter D Bethke <[EMAIL PROTECTED]>, MySQL List
<[EMAIL PROTECTED]>
cc:(bcc: David P. Giragosian
At 11:29 -0500 3/7/03, Peter D Bethke wrote:
Hello listers,
In mysql, is it possible imbed a conditional CASE statement within a SUM()
function to effect how the SUM() returns the final value for a set of rows?
For example, if I have a table "foo" with column "score", and "score" has
the rows with
Peter,
I think something like this will work:
mysql> select sum( if(score=7, score * 2, score)) from table_name;
David
-
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mys
13 matches
Mail list logo