I have a table with a field that has ID with numbers and I want to pull up the last record created and display the ID number. I want to do this because each ID number increases in I want to show how many members.
How to Pull up the last record in MS SQL from a table using ASP web page?
You can find the last record inserted into the table with this query:
SELECT TOP 1 ID FROM TableName ORDER BY ID DESC
Basically it says sort the table by the id in descending order and select the first record.
Edit:DHVRM has some good points in his answer below, but the query would be:
SELECT COUNT(*) AS totalsubscribers FROM tablename
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment