Unless you add an appropriate 'ORDER BY' statement, the results aren't going to be in any particular order... so you may get the 'value 3' row, followed by 'value 1', followed by 'value 2'.
Sounds like you should simply add an ORDER BY statement (if applicable) and perform the logic in the application to determine which row of the result set (if any) to use.