I have the following array:
var arr = ['A', 'B', 'C'...];
And in my database I have the categoria
column where the values are saved in the following way: 'A,B,C...'
, how could I make a SELECT
by taking each category of arr
and finding the corresponding values of my bank? Since there are so many categories, I would like to avoid using a loop in arr
.
I've tried something like this:
var categorias = ["A", "B", "C", "D", "E"];
var sql = "SELECT id_item, titulo, resumo, tipo FROM series WHERE categoria IN ('"+categorias.join()+"')";
But it does not work like PHP.