I am trying to execute an SQL command that should draw the last row that entered the database.
Basically, when a user submits the last thread (for example, in this forum), he redirects the user to a page with the heading of the thread, the paragraph of the thread, and data such as the username and time when the thread was sent.
I started working on the statement:
SELECT @UserID, u.UsersName, t.ThreadTitle, t.ThreadParagraph FROM Users as u INNER JOIN Threads as t ON u.UserID = t.UserID Where @UserID = t.UserId
The problem I am facing is that I need to add some instruction or aggregation function in order to return to me the last row that was entered into the thread table. How can I do it? what do i need to add?
source share