OBJECTIVE:
I am trying to get all the values in the column "test_results" from the table "test" where the studentID is the equal to some variable. I am trying to use the COUNT function in SQL to do this query however I keep getting an eror:
C# CODE:
MySqlCommand cmd = new MySqlCommand("SELECT COUNT(test_results) FROM test WHERE test.StudentID ='" + student + "';");
ERROR:
"cannot find specificed column in results: test_results"
Which is weird because I have no table named "results". Where did I make an error?
Thank You
EDIT:
MySqlCommand cmd = new MySqlCommand("SELECT COUNT(test_results) AS test WHERE studentID = '" + student + "';");
Gets rid of the previous error however I have another error which says:
you have an error in your SQL syntax near 'WHERE studentID = '6" at line 1