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 |
+----------------------------------------------------------------+
| Thread |
|---|
| • case (if-then) | (Saeed Teebi) | 4 Oct |
| • Re: case (if-then) | Tonu Samuel | 4 Oct |