New topic: How to request latest db update from date/time field?
<http://forums.realsoftware.com/viewtopic.php?t=48055> Page 1 of 1 [ 6 posts ] Print view Previous topic | Next topic Author Message tseyfarth Post subject: How to request latest db update from date/time field?Posted: Mon Jun 03, 2013 5:03 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 918 Hello All, Can anyone suggest the sql call to request the last update to a db? The db contains a field for Date and Time. I am having trouble getting my mind around the correct request call. Thank you, Tim Top elChupete Post subject: Re: How to request latest db update from date/time field?Posted: Mon Jun 03, 2013 5:34 pm Joined: Fri Jun 05, 2009 11:50 am Posts: 348 Location: Hamburg, Germany Does every record contain a datetimefield when the record has been inserted / updated? How is the date formated? In best case it is formated as sql date and each record has one. Then something like Select datetime from table order by date desc Should do the trick. The first record of the resulting record set isthe last date when a record was updated / inserted You might also want to check the sql max function Select max(datetime) from table _________________ Best regards Stefan Mac OSX Mountain Lion (latest Release) on a MacBook Pro 2.66 GHz Intel Core i7/ RB Professional 2011 Release 3 Top tseyfarth Post subject: Re: How to request latest db update from date/time field?Posted: Mon Jun 03, 2013 6:01 pm Joined: Sat Dec 04, 2010 9:14 pm Posts: 918 Thank you. Each record is updated/inserted with a SQLDateTime data string in the field. I will also have a look at the Sql MAX function too. Tim Top J.Hansen Post subject: Re: How to request latest db update from date/time field?Posted: Tue Jun 04, 2013 12:59 am Joined: Wed Dec 14, 2011 4:20 am Posts: 84 tseyfarth wrote:Hello All, Can anyone suggest the sql call to request the last update to a db? The db contains a field for Date and Time. I am having trouble getting my mind around the correct request call. Thank you, Tim For more informations, you might have a look on these two links: http://www.w3schools.com/sql/sql_quickref.asp http://www.tutorialspoint.com/mysql/index.htm Top tseyfarth Post subject: Re: How to request latest db update from date/time field?Posted: Tue Jun 04, 2013 1:34 am Joined: Sat Dec 04, 2010 9:14 pm Posts: 918 Thank you J. Hansen! Tim Top JeremK Post subject: Re: How to request latest db update from date/time field?Posted: Tue Jun 04, 2013 3:18 am Joined: Thu Apr 10, 2008 6:03 am Posts: 303 Location: Paris-La Défense, France You could use this query: Select * from mytable order by datefield desc limit 0, 1 This will select all fields from "mytable". It will order the data on "datefield" column and take the highest value. _________________ Check my Website for high quality custom controls and classes (no plugins) for Windows, Mac OS and Linux REALBasic 2012 R2 on Win 7 & Mac OS X Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 6 posts ]
-- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
