Re: Creating an aggregate operator

From: Steve Long <steven.long_at_erols.com>
Date: Sat, 11 Nov 2000 18:32:50 -0500
Message-ID: <8ukkoa$371$1_at_bob.news.rcn.net>


"Brett O'Neill" <bretto_at_swbell.net> wrote in message news:T82P5.834$_w6.105605_at_nnrp1.sbc.net...
> Does anyone know how to add a new aggregate operator, ie. "SECOND
 SMALLEST,"
> which would be similar to MIN?
>
> Any help greatly appreciated!
>
>
yes, but it depends on the smallest possible interval that can occur between min and 2nd min. depending on the interval, there are different algorithms that can be used, assuming efficiency is of interest. also, you have to determine if you are interested only in the value of the 2nd smallest or if the rows containing it are also of interest. i would expect since you are using an aggregate only the value is of interest.

if efficiency is not a concern, just create a temporary table will all the rows except the min row and then run min on the temp table. this is perhaps the least efficient way to solve the problem, but it works. Received on Sun Nov 12 2000 - 00:32:50 CET

Original text of this message