> Dear All, from a single row of a table, I have to select only the column, > which have a value larger '0' into an outfile. > How can I manage it with 'select'? Thanks, Jan
SELECT CASE can do that sort of thing for you. Here's a simplistic example: CREATE TABLE `test` ( `i1` int, `i2` int, `i3` int ); INSERT INTO `test` (`i2`) VALUES (2); SELECT CASE WHEN `i1` > 0 THEN 'Field 1' WHEN `i2` > 0 THEN 'Field 2' WHEN `i3` > 0 THEN 'Field 3' ELSE 'No match' END AS `iMatch` FROM `test`; +---------+ | iMatch | +---------+ | Field 2 | +---------+ -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]