On 8/13/07, Bryce Nesbitt <[EMAIL PROTECTED]> 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;

---------------------------(end of broadcast)---------------------------
TIP 9: In versions below 8.0, the planner will ignore your desire to
       choose an index scan if your joining column's datatypes do not
       match

Reply via email to