how to – SQL query valid in phpMyAdmin, but invalid in node.js using mysql package
I am trying to write a script that automatically downloads some items from a database in node.js, but am running into an error using the
mysql package (latest version: 2.15). I have a query of the form:
SELECT `R1`, `R2`, `Flags` FROM `table` WHERE `Flags` = 'F1' OR `Flags` = 'F2'
This works just fine if I manually run this query through phpMyAdmin, but when I create and run the exact same query using node.js, I get the error
Error: ER_OPERAND_COLUMNS: Operand should contain 1 column(s)
I’ve also tried using
IN ('F1', 'F2'), but that doesn’t work either. However, if I take out the items after the
OR (so it just filters on one value), it works through node.js.
Is there something wrong with my query that’s throwing these errors? Or is there another way to filter on multiple values that works for the mysql package?