RE: CASE statement and version 4.1.x

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

RE: CASE statement and version 4.1.x

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

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 procedures, so is it only supported for 5.x? >>> >>> I ca

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 execute the follo

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 in MS SQL Serve

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
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: "

Re: CASE statement within SUM()

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

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 "score" has the rows with

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