[TIP] Use COALESCE instead of nested IFNULL calls.
Ivan Smahin
IvanSmahin at public.kherson.ua
Tue Mar 15 14:48:05 CST 2005
Hello jda,
Tuesday, March 15, 2005, 2:40:22 PM, you wrote:
>>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
>>
>>
j> Hi Ivan,
j> I tried this select:
j> s = "select *,theDateSortMethod,COALESCE(authors, editors, title) as
j> 'ff' from thereferences where hit>0 ORDER BY ff,theDateSortMethod"
j> and got the error:
j> Feature Not Supported
j> Jon
j> _______________________________________________
j> Valentina-beta mailing list
j> Valentina-beta at lists.macserve.net
j> http://lists.macserve.net/mailman/listinfo/valentina-beta
It is just because of "ORDER BY ff".
We work to get this feature workable now.
--
Best regards,
Ivan mailto:IvanSmahin at public.kherson.ua
More information about the Valentina-beta
mailing list