Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Mon Sep 25, 2017 1:58 pm
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 6 posts ] 
Author Message
 Post subject: How to request latest db update from date/time field?
PostPosted: Mon Jun 03, 2013 5:03 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: How to request latest db update from date/time field?
PostPosted: Mon Jun 03, 2013 5:34 pm 
Offline
User avatar

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
 Profile  
Reply with quote  
 Post subject: Re: How to request latest db update from date/time field?
PostPosted: Mon Jun 03, 2013 6:01 pm 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: How to request latest db update from date/time field?
PostPosted: Tue Jun 04, 2013 12:59 am 
Offline

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
 Profile  
Reply with quote  
 Post subject: Re: How to request latest db update from date/time field?
PostPosted: Tue Jun 04, 2013 1:34 am 
Offline

Joined: Sat Dec 04, 2010 9:14 pm
Posts: 918
Thank you J. Hansen!

Tim


Top
 Profile  
Reply with quote  
 Post subject: Re: How to request latest db update from date/time field?
PostPosted: Tue Jun 04, 2013 3:18 am 
Offline

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
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group