We have a passwords table which references a user table. Records never get deleted from the password table so if a user changes their password, a new entry with a more recent `Created` date gets inserted.

The hash of the password is salted with various things, most importantly the created date of the actual record.

In a stored procedure, I'm retrieving variables so I can do a hash for comparison. I really just want to store the most recent password hash for a user along with the record's created date:

```
DECLARE @ExistingPassword as varchar(200)
DECLARE @LastChanged as DateTime

SELECT Top 1
    @ExistingPassword = p.PasswordHash,
    @LastChanged = p.Created, 
FROM Password as p
WHERE p.UserId = @UserId
ORDER BY p.Created DESC

```

Is this a reasonably efficient way of getting the most recent password hash and its created date? Is there a better way to do it?