-Log in
-Register (free)


-RSS Feeds
-New MyDesk Module
-Update to Profile

Alternate color for RS looping with For Next
Northwind / ASP - Nested select
ASP SQL Injection




 Forums /

Getting new records
Kevinneke | Posted 3:21am 3. February 2009 Server Time |

Hi all,

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)?

Thanks!

-Kevin.

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
1
Show all replies to 'Getting new records'
This post have been closed for new replies



| Info |
© Copyright 1997-2013 Alexander Haneng