Digital Workshop

Welcome to the Digital Workshop Message Boards
It is currently December 22nd, 2024, 12:25 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 2 posts ] 
Author Message
 Post subject: LastRecord() in Very Large Table in DB
PostPosted: March 7th, 2013, 1:56 pm 
Offline

Joined: May 25th, 2008, 4:57 pm
Posts: 355
Location: Ireland
Opus: Pro 9.75
OS: Windows 10
System: MacBook Pro (Intel 2020)
Hi Everyone,

I need to select the last record in a very large database via scripting.

Currently I use the following, but when over 2 million records it can be a bit slow as it's doing more processing than needed maybe.


Code:
//THIS SETS THE LAST ENTRY IN THE DB TO THE CURRENT STUDENT
var Rset = KYW_db_usr.ExecuteSQL("SELECT UserName, UserID FROM Users_Records");
Rset.LastRecord();

CurrentStudentName = Rset.UserName;
CurrentStudentID =  Rset.UserID;





Any suggestions for best options, UserID is an auto incrementing number. I was trying to use "SELECT * FROM Users_Records ORDER BY UserID DESC LIMIT 1" SQL but the LIMIT 1 keeps throwing an error.

_________________
Opus Pro 9.75 on MacBookPro (2020 Intel) running Parallels 19 with Windows 10 (x64)


For this message lmc has been thanked by : mackavi


Top
 Profile  
 
 Post subject: Re: LastRecord() in Very Large Table in DB
PostPosted: March 8th, 2013, 12:28 pm 
Offline
Godlike
Godlike
User avatar

Joined: March 21st, 2007, 10:44 am
Posts: 3188
Location: UK
Opus: Evolution
What database is it?

Mack

_________________
When you have explored all avenues of possibilities, what ever remains, how ever improbable, must be the answer.

Interactive Solutions for Business & Education
Learn Anywhere. Learn Anytime.

www.interaktiv.co.uk
+44 (0) 1395 548057


Top
 Profile Visit website  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 2 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 38 guests


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
You cannot post attachments in this forum

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