[MonetDB-users] Is there IF(), IFNULL() in SELECT?
Sorry if it was asked before, I can't find a comprehensive list of functions available. Is it possible to somehow implement something like this: SELECT IF(col1>0,'Negative','Positive') as Sign, IFNULL(col2,'Empty',col2) as col2 FROM table; // it's just an example, not the exact query :) Thanx!
On 30-08-2012 17:02:15 -0400, Dmitry Insta wrote:
Sorry if it was asked before, I can't find a comprehensive list of functions available. Is it possible to somehow implement something like this:
SELECT IF(col1>0,'Negative','Positive') as Sign, IFNULL(col2,'Empty',col2) as col2 FROM table;
SELECT CASE WHEN col1 > 0 THEN 'Negative' ELSE 'POSITIVE' END AS "Sign", CASE WHEN col2 IS NULL THEN 'Empty' ELSE col2 END AS col2 FROM table; You may need explicit casts to make the strings from the WHEN and ELSE clauses fit/be compatible.
participants (2)
-
Dmitry Insta
-
Fabian Groffen