java - Insert only if row doesn't exist -
i using preparedstatement prepare sql queries. want insert row in table if , if doesn't exist.
i tried -
insert users (userid) values (?) on duplicate key update userid = ?
but unnecessarily update userid.
how can insert userid
here ?
insert users (userid) select ? not exists ( select * users userid = ? )
Comments
Post a Comment