I am trying to display the results of a basic arithmetic test created in python, the test is repeated three times and collects three scores, this works fine, however whe I try to display these by the highest score of the three in descending order I am displayed an error message. which is as follows.
Traceback (most recent call last):
File "F:\Adair,Rowan CA2\Task 3\Code\DisplayTablesScore.py", line 4, in <module>
cursor.execute("SELECT * FROM class1 ORDER BY (score1,score2,score3) DESC")
sqlite3.OperationalError: near ",": syntax error
However when it is organised by one of the columns e.g. only score 1 it works fine. The code that I cannot figure out how to fix is below.
import sqlite3
connection = sqlite3.connect("class1.db")
cursor = connection.cursor()
cursor.execute("SELECT * FROM class1 ORDER BY (score1,score2,score3) DESC")
print("Class 1:")
result = cursor.fetchall()
for r in result:
print(r)
Any help with this would be immensly appreciated, I am also trying to determine the average aswell.