MySQL is throwing Unknown column 'reported_bugs' in 'where clause'
whenever I try selecting all the rows that have reported_bugs as their bugLoc. I'm not sure what's going wrong, because I'm not trying to select a column named reported_bugs.
Here's the line it throws the error on:
reported_bugs = cursor.execute(f"SELECT bugDesc FROM {username}Bugs WHERE bugLoc = reported_bugs")
I need it to find all rows that have "bugLoc" as "reported_bugs," and get the bugDesc from those rows. Any help would be greatly appreciated!
CodePudding user response:
if you don't add quotes reported_bugs is interpreted like a name. Instead you were looking for the string value, so you must write
reported_bugs = cursor.execute(f"SELECT bugDesc FROM {username}Bugs WHERE bugLoc = 'reported_bugs'")