John John - 17 days ago 8
MySQL Question

Issues executing a MYSQL query (if a condition is met)

I run into a connection issue while attempting to run the following query:

"SELECT box_id, longestDimension from box where longestDimension != '' AND box_id == 'Box11'"


It was working fine with only this

"SELECT box_id, longestDimension from box where longestDimension != ''"


So I am guessing the issue is this

box_id == 'Box11'


This code is being run through nodeJs

Answer

Of course John, operator == in mysql does not exist

"SELECT box_id, longestDimension from box where longestDimension != '' AND box_id = 'Box11'"

Must be like this