I want a single update query where I want to update email id in database. In database already contain some email id like : Id : Email id 1 : 2 : 3 : if I update id no 1 record and not change this email id and as it is update then not showing already exist like : 1 : and i update same email id then not showing already exist but here update on id no 1 then showing already exist and if update on id no 1 then update this record. I want a single query no any php condition like that below insert query : INSERT INTO tbo_user (User_ID, User_Name, User_Email, Password, Created) SELECT * FROM (SELECT 'anu_12345', 'Anshu Singh', '', '8626fe7dcd8d412a80d0b3f0e36afd4a', '1520835353') AS tmp WHERE NOT EXISTS ( SELECT * FROM tbo_user WHERE User_ID = 'sdfas' or User_Email = '' ) LIMIT 1;