Subject Re: [firebird-support] aggregate query help
Author Helen Borrie
At 03:13 PM 22/10/2004 +0000, you wrote:


>Hi,
>
>I need some help with a query.
>
>I have a storedporce that return smth like that
>
>col1, col2, col3
>11, aaa, BBB
>12, aaa, CCC
>13, bbb, DDD
>
>I want to reduce this set to
>col1, col2, col3
>11, aaa, BBB
>13, bbb, DDD
>
>it seems like a simple grouping
>but I can't find any function to aggregate. Would it be numbers I'd
>use max() or sum(), but since this are text I am at loss.
>
>I don't care which one of the (11 or 12) go into the set.
>I'd use first(colname) in MySQL or Access, but alas its not here.
>
>Any ideas, or should I just go ahead and build a stored proc where I
>would pass this set ordered by col2 and skip the suspend on nochange?

That's what I would do, because the alternative would be to do a SELECT
DISTINCT col, col2, col3 on the SP output, which would be costly.

./heLen