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

Popular posts from this blog

SPSS keyboard combination alters encoding -

Add new record to the table by click on the button in Microsoft Access -

CSS3 Transition to highlight new elements created in JQuery -