Getting new records|
Kevinneke | Posted 3:21am 3. February 2009 Server Time |
I want to get the latest records from a database, starting with a specific id.
SQLstmt = "SELECT x.* FROM (SELECT * FROM Chatlog WHERE Kamer='algemeen' ORDER BY ID DESC LIMIT 0,max(`id) - " & session("aantal_records") & ")x ORDER BY ID ASC"
But this isn't a correct statement. Can I use max in a SQLquery or is the best way to execute 2 query's (one for getting the highest record id number and one to get the latest records, by the use of the highest record id session)?
arrowgance | Posted 7:16am 6. May 2009 Server Time ||
select top 1 id from chatlog
ORDER BY ID DESC LIMIT
should be enough, unless you have a datetime stamp...or you want to get the chatlogs daily, weekly, whatever
Reply to Post Getting new records