Check if a value exists before updating a column for a already existing record in mysql
Lets say I have table called Tokens, with columns: id, refresh_token, and token. refresh_token column should be unique. But we may have many refresh_token fields that are null. These null refresh_token fields should be updated later, but there is a possibility that we may try to enter a refresh_token value that is contained in another field, and that will cause a conflict. So, what I wanted to do is: First check if the refresh_token value is contained in any other fields. If it is not contained or if unique, the that new refresh_token value can be used to update a specific row with a given id.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.