Hi Ali, all!
Ali Deniz EREN wrote:
> table_1
> id pid nid
> ---
> 1 60
> 2 05
>
> table_2 (referer -> pid)
> id title body
> ---
> 1 title1 body_text1
> 2 title2 body_text2
> 3 title3 body_text3
> 4 title4 body_text4
> 5
I tried something like this but it doesnt work. Thank you..
"SELECT table_1.id FROM table_1
CASE
WHEN (table_1.pid <> 0)
THEN LEFT JOIN table_2 ON table_1.pid = table_2.id
WHEN (table_1.nid <> 0)
THEN LEFT JOIN table_3 ON table_1.nid = table_3.id
END"
2009/2/24 Ali Deniz EREN
> table
table_1
id pid nid
---
1 60
2 05
table_2 (referer -> pid)
id title body
---
1 title1 body_text1
2 title2 body_text2
3 title3 body_text3
4 title4 body_text4
5 title5 body_text5
6 title6 body_text6
7 title7 body_text
col_a = CASE WHEN col_a = 1
THEN col_a + 1
ELSE 0
END;
Hope this helps,
- Bennett
-Original Message-
From: Jeremy March [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 4:09 PM
To: [EMAIL PROTECTE
Using CASE... WHEN... THEN in my update query doesn't behave the way I
expect it to. It's using the result of the query in the second WHEN
condition rather than the original value. See this example:
CREATE TABLE t1 (col_a tinyint not null, col_b tinyint not null);
INSERT INTO t1 V
AS RESULT ;
-Original Message-
From: Harald Fuchs [mailto:lists-mysql@;news.protecting.net]
Sent: Friday, October 25, 2002 5:42 AM
To: [EMAIL PROTECTED]
Subject: Re: Strange behavior of CASE .. WHEN ... THEN
In article <000701c27193$1bf2bfa0$aa3fe7cb@jsheo>,
"Heo, Jung
At 11:41 +0200 10/25/02, Harald Fuchs wrote:
In article <000701c27193$1bf2bfa0$aa3fe7cb@jsheo>,
"Heo, Jungsu" <[EMAIL PROTECTED]> writes:
Hello, every one.
I Found a bug about CASE .. WHEN .. THEN..
mysql> SELECT VERSION() ;
++
| VERSION() |
+--
Hello, every one.
I Found a bug about CASE .. WHEN .. THEN..
mysql> SELECT VERSION() ;
++
| VERSION() |
++
| 4.0.3-beta |
++
1 row in set (0.00 sec)
mysql> select CASE NULL WHEN NULL THEN 0 ELSE 1 END AS RESULT ;
++
| RESULT |
++
|