Return-Path: Mailing-List: contact torque-user-help@db.apache.org; run by ezmlm Delivered-To: mailing list torque-user@db.apache.org Received: (qmail 38267 invoked from network); 24 Mar 2003 17:59:39 -0000 Received: from zebra.zinkwazi.com (66.139.79.200) by daedalus.apache.org with SMTP; 24 Mar 2003 17:59:39 -0000 Received: (from dallen@localhost) by zebra.zinkwazi.com (8.11.6/8.11.6) id h2OHxh418502 for torque-user@db.apache.org; Mon, 24 Mar 2003 11:59:43 -0600 Date: Mon, 24 Mar 2003 11:59:43 -0600 From: Dan Allen To: torque-user@db.apache.org Subject: getting id of MAX entry Message-ID: <20030324115943.C32276@mojavelinux.com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline User-Agent: Mutt/1.2.5.1i X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N This is sort of more SQL related, but how would you find the id of the record that is returned as the MAX() of another column. For instance, just say I had events that occured at all different times. I wanted to find the most recent event. I would do select MAX(date) from table; but now I want something like select event_id, MAX(date) from table; naturally that gives a mix error, so what would I do? I could always query again with the result of the MAX(date) used the next query, but I can't seem to use MAX in the where clause either. Dan -- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Daniel Allen, http://www.mojavelinux.com/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - Chaos reigns within. Reflect, repent, and reboot. Order shall return. - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -