One way in which you could address the problem is using an
   auto-incrementing integer as your primary key (call it id or
   something), and then each time a new entry is added to the table a new
   integer (row id) will be created. then you just need to get the MAX
   id. That will skip the sorting.
   >From: "District Webmaster"
   >Reply-To: BYU Unix Users Group
   >To:
   >Subject: Re: [uug] SQL help (most recent)
   >Date: Mon, 20 Oct 2003 12:29:45 -0600
   >MIME-Version: 1.0
   >Received: from mc6-f34.hotmail.com ([65.54.252.170]) by
   mc6-s21.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 20 Oct
   2003 11:30:57 -0700
   >Received: from phantom.byu.edu ([128.187.211.246]) by
   mc6-f34.hotmail.com with Microsoft SMTPSVC(5.0.2195.5600); Mon, 20 Oct
   2003 11:28:43 -0700
   >Received: from localhost ([127.0.0.1] helo=phantom.byu.edu)by
   phantom.byu.edu with esmtp (Exim 3.36 #1 (Debian))id 1ABel0-0002eI-00;
   Mon, 20 Oct 2003 12:27:54 -0600
   >Received: from mail.adm.alpine.k12.ut.us ([204.113.108.65])by
   phantom.byu.edu with esmtp (Exim 3.36 #1 (Debian))id
   1ABekl-0002eC-00for ; Mon, 20 Oct 2003 12:27:39 -0600
   >Received: from Alpine School District-MTA by
   mail.adm.alpine.k12.ut.uswith Novell_GroupWise; Mon, 20 Oct 2003
   12:29:52 -0600
   >X-Message-Info: BVVQfv+dWoOsjJQjj0fXJF7PUVw3IgW7toj0+Y2DgUo=
   >Message-Id:
   >X-Mailer: Novell GroupWise Internet Agent 6.5.1
   >X-BeenThere: [EMAIL PROTECTED]
   >X-Mailman-Version: 2.1.2
   >Precedence: list
   >List-Id: BYU Unix Users Group
   >List-Unsubscribe: ,
   >List-Archive:
   >List-Post:
   >List-Help:
   >List-Subscribe: ,
   >Sender: [EMAIL PROTECTED]
   >Errors-To: [EMAIL PROTECTED]
   >Return-Path: [EMAIL PROTECTED]
   >X-OriginalArrivalTime: 20 Oct 2003 18:28:45.0384 (UTC)
   FILETIME=[FF024480:01C39737]
   >
   >Perhaps you can create a date field with the default value being
   >Now()-- then sort by said field.
   >
   >see also:
   >http://www.mysql.com/doc/en/Date_and_time_functions.html
   >
   >Dave
   >
   > >>> [EMAIL PROTECTED] 10/20/03 12:09 PM >>>
   > I'm creating a simple mySQL database that is being populated by a
   perl
   >script. Each entry will corresponds to an event that is happening on
   >another machine. I'm looking for an SQL query that will return the
   most
   >recent entry and I have no way of knowing when that might have been.
   It
   >may
   >have been two hours ago, or two weeks.
   > The only way I can think of is to ask for the list to be sorted and
   >take
   >the first row, but this seems wrong in every way, especially once the
   >list
   >starts to grow.
   > Any ideas?
   >
   >dave
   >
   >____________________
   >BYU Unix Users Group
   >http://uug.byu.edu/
   >___________________________________________________________________
   >List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
   >
   >
   >____________________
   >BYU Unix Users Group
   >http://uug.byu.edu/
   >___________________________________________________________________
   >List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list
     _________________________________________________________________

   [1]Send instant messages to anyone on your contact list with MSN
   Messenger 6.0. Try it now FREE! 

References

   1. http://g.msn.com/8HMAENUS/2737??PS=
____________________
BYU Unix Users Group 
http://uug.byu.edu/ 
___________________________________________________________________
List Info: http://uug.byu.edu/cgi-bin/mailman/listinfo/uug-list

Reply via email to