On Saturday, July 19, 2014 02:56:24 PM Reindl Harald wrote:
> > ERROR 1064 (42000): You have an error in your SQL syntax; check the manual
> > that corresponds to your MariaDB server version for the right syntax to
> > use
> > near 'DISTINCT sum) THEN sum(cost) ELSE NULL END AS cost_sum
> > from p
Am 19.07.2014 13:45, schrieb Arup Rakshit:
> Here is my simple table
>
> MariaDB [tutorial]> select * from prices;
> ++--+--+
> | id | name | cost |
> ++--+--+
> | 1 | A| 1200 |
> | 2 | A| 2500 |
> | 3 | A| 3000 |
> | 4 | B| 5000 |
> | 5 | B| 7000
Here is my simple table
MariaDB [tutorial]> select * from prices;
++--+--+
| id | name | cost |
++--+--+
| 1 | A| 1200 |
| 2 | A| 2500 |
| 3 | A| 3000 |
| 4 | B| 5000 |
| 5 | B| 7000 |
| 6 | C| NULL |
++--+--+
6 rows in set (0.00 se
t;
instead of just "END". So I used the same syntax as
T-SQL with "END" and it worked fine.
It sounds as though you read the first paragraph, but not the second,
which states:
Note: The syntax of a CASE statement shown here for use inside a stored
procedure differs slig
> >>> 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 an
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 procedur
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 e
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 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.
The reason I'm asking is because in other SQL
dialects, suc
QF = CASE WHEN QF = 1 THEN 5 END
WHERE
QA = 1 AND (QE <> 6 OR QF <> 5)
http://dev.mysql.com/doc/mysql/en/Control_flow_functions.html
Lachlan
-Original Message-
From: Mo Li [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 August 2004 9:01 AM
To: [EMAIL PROTECTED]
Subject: Questi
o Li [mailto:[EMAIL PROTECTED]
Sent: Thursday, 12 August 2004 9:01 AM
To: [EMAIL PROTECTED]
Subject: Question about case statement
Hello,
I'm trying to update table by using case statement.
I used following syntax:
UPDATE temp
SET
CASE WHEN QE = 1 THEN QE = 6 WHEN QF = 1 THEN QF = 5
END
WHERE QA
Hello,
I'm trying to update table by using case statement.
I used following syntax:
UPDATE temp
SET
CASE WHEN QE = 1 THEN QE = 6 WHEN QF = 1 THEN QF = 5
END
WHERE QA = 1 AND ( QE != 6 OR QF !=5)
but it didn't work. I checked the manual and didn't
see where is the problem.
Than
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
27; )) OR
( status IN ( 'NA', 'NG', 'RA' )));
- Original Message -
From: "Chris Boget" <[EMAIL PROTECTED]>
To: "MySQL" <[EMAIL PROTECTED]>
Sent: Friday, October 24, 2003 2:19 PM
Subject: Case statement
> I'm tryin
I'm trying to do something like the following:
SELECT
CASE status
WHEN
IN ( 'BR', 'VQ', 'RQ', 'NG' )
THEN
'binding'
WHEN
IN ( 'NA', 'NG', 'RA' )
THEN
'approving'
END as action
FROM master_info WHERE
(( status IN ( 'BR', 'VQ', 'RQ', 'NG' )) OR
( status IN ( 'NA', 'NG', 'RA' )));
But this quer
/MDACC)
Subject: Re: CASE statement within SUM()
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 exampl
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
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
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 the value
22 matches
Mail list logo