Hi,
Imagine I already have a query that returns the following:
Col1 | Col2
------------
A | 2
B | 3
C | 3
D | 4
E | 8
...
Say I used something like this:
select Col1, count ( * ) as Col2 \
from ...
where ...
order by Col2 \
group by Col1 \
So now, all I want to select are (Col1, Col2)
such that it returns the selections (a, b) and (c, d) where (b >= all (Col2)) and (d >= ((all (Col2)) - a)).
So for the above example, it would return {(A, 2), (B, 3), (C, 3)}
. How do I go about doing this?
Any help would be highly appreciated. Thanks.