Put the other fields after the CASE statement:
SELECT
CASE
WHEN CHARACTER_LENGTH(system) > 65
THEN
CONCAT(LEFT(system, 60), " ...")
ELSE
system
END,
wsh_year,
id
FROM wsh
The CASE statement just returns 1 field.
-----Original Message-----
From: Richard Forgo [mailto:[EMAIL PROTECTED]
Sent: Monday, February 24, 2003 3:21 PM
To: 'MySQL Mailing List'
Subject: case expression
Hello all ... be gentle, I'm new at this:
I've got a simple case query. One works (the top one), but when I try
to add additional columns to the query it fails. I reckon it's a pretty
simple mistake I'm making, but I don't know what. Any help is
appreciated.
-----------------------------------------------------
This works ...
SELECT CASE WHEN CHARACTER_LENGTH(system) > 65 then
CONCAT(LEFT(system, 60), " ...")
ELSE
system END
------------------------------------------------------
This doesn't ...
SELECT CASE WHEN CHARACTER_LENGTH(system) > 65 then
CONCAT(LEFT(system, 60), " ..."), wsh_year, id
ELSE
system, wsh_year, id END
FROM wsh
Maybe an IF statement would work better here?
Rik Forgo
JIST3
Army Test, Training and Technology Integration Office (T3I)
Diverse Technologies Corp.
(c) 443.463.8571
(h) 410.859.8474
> ---------------------------------------------------------------------
> Before posting, please check:
> http://www.mysql.com/manual.php (the manual)
> http://lists.mysql.com/ (the list archive)
>
> To request this thread, e-mail <[EMAIL PROTECTED]>
> To unsubscribe, e-mail <mysql-unsubscribe-
> [EMAIL PROTECTED]>
> Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php
---------------------------------------------------------------------
Before posting, please check:
http://www.mysql.com/manual.php (the manual)
http://lists.mysql.com/ (the list archive)
To request this thread, e-mail <[EMAIL PROTECTED]>
To unsubscribe, e-mail <[EMAIL PROTECTED]>
Trouble unsubscribing? Try: http://lists.mysql.com/php/unsubscribe.php