Aye, to things about your solution, 1 it'll always return just 1 user, no matter if multiple users updated their profile at once. 2. all the dates will be < current_timestamp, since they were all made in the past, not the future (unless they can time travel) so that statement is overkill.
i would rephrase the query to SELECT * FROM table_name WHERE modified_datetime = (SELECT TOP 1 modified_datetime FROM table_name ORDER BY modified_datetime DESC;);
subquery returns last date and then main query returns all records matching that date
Enter your message below
Sign in or Join us (it's free).