----------
From: Tonu Samuel[SMTP:tonu@stripped]
Sent: Monday, October 04, 1999 7:30 AM
To: saeed@stripped
Cc: mysql@stripped
Subject: Re: case (if-then)
Saeed Teebi wrote:
> My current code is below, with minor
> modifications. I'm actually using DBI (all this
> is nested inside a prepare stmt) as well, but I
> edited that out.
> CASE WHEN (SELECT a.alt_names FROM Cell_rep c
> LEFT JOIN Altnames a ON c.mckusick = a.mckusick
> WHERE a.mckusick = "$value")
Oh my god!
> I know the WHEN clause doesn't make sense. What
> I want to do is tell mysql that when a.mckusick
> = "$value", given the preceding join, it should
> proceed to the THEN or ELSE. I couldn't really
> see how to do that, since joins only work with
> select stmts.
> The version of Mysql is 3.21.33c-log
At first: subselects implemented from versions 3.23
Other thing is that it can't work in your way. Subselects work only in
context where they are used as lists (blabla IN 1,2,3,4... -> blabla IN
(SELECT something) ). It isn't meant to work like this. Maybe it works
somewhere else but not in MySQL now.
--
+----------------------------------------------------------------+
| TcX ____ __ _____ _____ ___ |
| /*/\*\/\*\ /*/ \*\ /*/ \*\ |*| Tõnu Samuel |
| /*/ /*/ /*/ \*\_ |*| |*||*| tonu@stripped |
| /*/ /*/ /*/\*\/*/ \*\|*| |*||*| Tallinn, Estonia |
| /*/ /*/ /*/\*\_/*/ \*\_/*/ |*|____ |
| ^^^^^^^^^^^^/*/^^^^^^^^^^^\*\^^^^^^^^^^^ |
| /*/ \*\ Developers Team |
+----------------------------------------------------------------+
---------------------------------------------------------------------
Please check "http://www.mysql.com/Manual_chapter/manual_toc.html" before
posting. To request this thread, e-mail mysql-thread15053@stripped
To unsubscribe, send a message to the address shown in the
List-Unsubscribe header of this message. If you cannot see it,
e-mail mysql-unsubscribe@stripped instead.