You could loop through every entry and compare the usernames, but why not just show a message that a different username must be used when the user tries to submit an entry?
I want to use it for a random username generator. I might try the looping, but I am scared, that it will result in a lot of lag. But thanks for the reply anyway, I might try looking into it a bit more!