Subject | RE: [firebird-support] records to columns |
---|---|
Author | Svein Erling Tysvær |
Post date | 2008-08-22T12:14:37Z |
>Thanks Alan & Svein for both answers !!!Sorry that I answered it, even though I read the titles of the eight mails that had been sent since you asked your question, I failed to see that Alan had already answered...
>May I ask two more questions?Regarding SUM, you at least seem to be correct when testing on Firebird 1.5.4 - NULLs are not included when using SUM.
>1) I thought that the SUM function didn't use the NULL values. Actually, what I
>was told is that none of the aggregate functions uses NULL values. So I never
>check for nulls when I use SUM(). Am I wrong?
>2) Do you think this aproach would be faster than having separated selects?When used in a stored procedure, I would expect the performance to be similar - though I may be wrong. Try it for yourself. I would expect it to be quicker if used from a client since you don't have to (prepare and) open several datasets.
The main benefit as I see it by using Alan's suggestion (at least when removing COALESCE and putting SUM outside CASE), is that your code gets shorter and that you can get the row returned without using a stored procedure.
HTH,
Set