Код: Выделить всё
def get_expenses_by_type(self, current_user):
try:
cursor = self.main_db.cursor(dictionary=True)
if self.check_user_level(current_user) == 0:
query = """
SELECT Date, Type, SUM(Price * Quantity) AS TotalAmount
FROM ExpenseTable
WHERE UserID = %s
GROUP BY Date, Type;
"""
else:
query = """
SELECT Date, Type, SUM(Price * Quantity) AS TotalAmount
FROM ExpenseTable
GROUP BY Date, Type;
"""
cursor.execute(query, (current_user,))
results = cursor.fetchall()
cursor.close()
return results
except Exception as error:
raise error
Код: Выделить всё
mysql.connector.errors.ProgrammingError: Not all parameters were used in the SQL statement
Подробнее здесь: https://stackoverflow.com/questions/793 ... using-mysq
Мобильная версия