I have the following SQL select statement
SELECT first_name, year FROM users WHERE username='$username'
This can return many results because a user record can exist per year e.g. one for 2012, 2011 etc. Therefore I want to only fetch the details of the user from the latest year that the user record exists for.
Any ideas how i can do this?
Thanks
You can find the max year for a user, and then nest that so that you only select the one record with that year.