On Mar 25, 2008, at 11:33 AM, Sam Mason wrote:
> On Mon, Mar 24, 2008 at 05:27:04PM -0500, Decibel! wrote:
>> On Mar 20, 2008, at 2:23 PM, Sam Mason wrote:
>>> SELECT i, (MIN((j,k))).k
>>> FROM tbl
>>> GROUP BY i;
>>
>> How is that any better than SELECT i, min(k) FROM tbl GROUP BY i ?
>
> Because I want the value of k associated with the minimum value of j.
Ahh, makes sense. FWIW...
SELECT i, (SELECT k FROM ... WHERE i = i.i ORDER BY j LIMIT 1) FROM (SELECT DISTINCT i FROM ...) i
;
If you needed more than just k, I think there's a way to do that in
the FROM clause, too.
--
Decibel!, aka Jim C. Nasby, Database Architect decibel@decibel.org
Give your computer some brain candy! www.distributed.net Team #1828