mysql - Add user if not exists in another table -
i need add usernames users_waiting table if not added users table before.
var usernamesarray = ['test', 'test2']; connection.query('replace users_waiting (username) values ?', [usernamesarray]);
i'm using node.js mysql client , have no idea how that.
you have many options of doing it. 1 of not exists()
:
insert <table2> (...) select .... <source> t not exists(select 1 <table1> s t.id = s.id);
i don't think it's need. can figure out rest this.
Comments
Post a Comment