[TIP] Use COALESCE instead of nested IFNULL calls.
Ivan Smahin
IvanSmahin at public.kherson.ua
Tue Mar 15 11:52:16 CST 2005
Hello Valentina,
Here is just a tip.
Example:
SELECT
IFNULL(f1, IFNULL(f2,f3)) as 'ff'
FROM
t1
Here we just need to get first not-null value using field-order - f1,f2,f3.
The issue seems to be a little bit bulky.
You can use COALESCE instead of. It seems more clear and concisely.
Look:
SELECT
COALESCE(f1, f2, f3) as 'ff'
FROM
t1
--
Best regards,
Ivan mailto:IvanSmahin at public.kherson.ua
More information about the Valentina-beta
mailing list