I am not sure how I should explain this error since it could be one of many things. But, in short, DBI tells me that there is a syntax error in the query, even though when I print the query to the browser and then copy-paste it into the terminal to execute it, it works.
What are some obvious things to look for when getting these kinds of errors?