On Thu, Feb 13, 2003 at 09:57:06AM -0500, Luc Foisy wrote: > > I don't think it is possible at the moment, and pretty sure its not standard SQL but >it would still be neat to have > > SELECT aField, COLUMN_IF( some_expression, 'afield2' AS 'aColumn' ) FROM aTable > > So in this example, if the expression was true, include that column in the result >set, otherwise don't > Sure this can be handled outside MySQL and just change the query on condition, just >thought it would be nice
You can use a WHERE clause to get an effect like this. Something like: SELECT CASE expression WHEN 'value' THEN column ... ELSE 'default result' END FROM Table; Cheers! -- Zak Greant <[EMAIL PROTECTED]> | MySQL Advocate | http://zak.fooassociates.com MySQL Tip: Load the contents of a text file into a field mysql> INSERT table (field) VALUES (LOAD_FILE("/path/to/file")); See http://mysql.com/doc/en/String_functions.html for more details Email signature rotated by Signify v1.10 <http://www.debian.org/> --------------------------------------------------------------------- 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