Re: DISTINCT not working inside a CASE statement.

2014-07-19 Thread Arup Rakshit
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

Re: DISTINCT not working inside a CASE statement.

2014-07-19 Thread Reindl Harald
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

DISTINCT not working inside a CASE statement.

2014-07-19 Thread 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 | | 6 | C| NULL | ++--+--+ 6 rows in set (0.00 se

RE: CASE statement and version 4.1.x

2005-03-09 Thread Paul DuBois
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

RE: CASE statement and version 4.1.x

2005-03-09 Thread Homam S.A.
> >>> 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

RE: CASE statement and version 4.1.x

2005-03-09 Thread Tom Crimmins
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

Re: CASE statement and version 4.1.x

2005-03-09 Thread Philippe Poelvoorde
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

Re: CASE statement and version 4.1.x

2005-03-08 Thread Daniel Kasak
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

CASE statement and version 4.1.x

2005-03-08 Thread Homam S.A.
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

Re: Question about case statement

2004-08-11 Thread Michael Stassen
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

RE: Question about case statement

2004-08-11 Thread Lachlan Mulcahy
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

Question about case statement

2004-08-11 Thread Mo Li
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

Re: Case statement

2003-10-24 Thread Mojtaba Faridzad
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

Re: Case statement [SOLVED]

2003-10-24 Thread Chris Boget
> 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;

Re: Case statement

2003-10-24 Thread Mojtaba Faridzad
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:

Re: Case statement

2003-10-24 Thread Chris Boget
> 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

Re: Case statement

2003-10-24 Thread Mojtaba Faridzad
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

Case statement

2003-10-24 Thread Chris Boget
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

Re: CASE statement within SUM()

2003-03-07 Thread dpgirago
/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

Re: CASE statement within SUM()

2003-03-07 Thread Paul DuBois
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

Re: CASE statement within SUM()

2003-03-07 Thread dpgirago
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

CASE statement within SUM()

2003-03-07 Thread Peter D Bethke
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