I have a column where data is saved in the following syntax:
Value1;Value2;Value3
I have an array and I would like to check if any of the elements contain a value in the table. I read a little bit and found that the SQL Query:"WHERE...IN.. should do this but I havent done it successfully right now. Here is my command:
db.query(
'SELECT * FROM blocklist WHERE BanContent IN ?', [inputarray.join(",")],
function (err, results) {
try {
console.log(results)
} catch (err) {
console.log(err);
}
});
I allways get undefined as the result.
Consider the following:
SELECT FIND_IN_SET('v2',REPLACE('v1;v2;v3',';',','))x;
+---+
| x |
+---+
| 2 |
+---+
And now see about normalisation and why it's a bad idea to store delimited data in an RDBMS.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.