Luc, Zak,

>> SELECT aField, COLUMN_IF( some_expression, 'afield2' AS 'aColumn' ) FROM aTable

> You can use a WHERE clause to get an effect like this.
>   SELECT CASE expression
>         WHEN 'value'
>         THEN column
>         ...
>         ELSE 'default result'
>         END
>     FROM Table;

Or even IF() ;-)

mysql> SELECT IF(c='foo',c,'N/A') FROM t;
+---------------------+
| IF(c='foo',c,'N/A') |
+---------------------+
| N/A                 |
| foo                 |
| N/A                 |
| N/A                 |

Regards,
--
  Stefan Hinz <[EMAIL PROTECTED]>
  iConnect GmbH <http://iConnect.de>
  Heesestr. 6, 12169 Berlin (Germany)
  Telefon: +49 30 7970948-0  Fax: +49 30 7970948-3


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

Reply via email to