On 8/13/07, Bryce Nesbitt <bryce1(at)obviously(dot)com> wrote:
> In the second example, is it possible to get the primary key of the row
> with the minimum expires time?
SELECT TYPE, MIN(expires), COUNT(*)
, (SELECT MIN(coupon_id)
FROM coupon
WHERE expires = MIN(c.expires)) AS coupon_id
FROM coupon c
GROUP BY TYPE;