I have an array where each element corresponds to an alphanumeric string, lets say :
userIds : ['Ab526', 'shvx23', '23636dsd']
I want to convert it into such a format so that I can pass this list of strings to IN clause of mySQL query as something like :
Select * from Users where userIds in '(...)';
I tried using array.join() and many other methods, suggested somewhere or the other but all in vain.
var userIds = ['Ab526', 'shvx23', '23636dsd']
var ids = userIds.join(',');
var query = 'Select * from Users where userIds in (' + ids + ')';
console.log(query);
which results in :
Select * from Users where userIds in ('Ab526, shvx23, 23636dsd');
If anyone could suggest a solution as how can I achieve what I want to, it would be of great help.