1
BEGIN
2
declare result longtext;
3
set @result = NULL;
4
5
SELECT efd.value FROM extrafielddata efd where efd.ExtraFieldID = efdID and efd.ID = cmpID into @result;
6
select ifnull(@result,efd.Value) from extrafielddata efd where efd.ExtraFieldID = efdID and efd.ID = 0 into @result;
7
8
return @result;
9
END