SQL Server & Python // Column is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause

I am currently running into the above error when running my python pyodbc code that is meant to print a financial report into Excel. Here is the full error description

('42000', "[42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Column 'Client.Account' is invalid in the select list because it is not contained in either an aggregate function or the GROUP BY clause. (8120) (SQLExecDirectW); [42000] [Microsoft][ODBC SQL Server Driver][SQL Server]Statement(s) could not be prepared. (8180)")

What I have read in other solutions is that they are having a problem with a "Group By" clause in their statement, however, my code does not include a group by clause. Please see the below views.py code:

  current = " Select Account , Name , DCBalance, EMail , Sum(Credit) - Sum(Debit) as Current from dbo.PostGL as gl "\
    "Inner JOIN Client on gl.DrCrAccount = Client.DCLink "\
    "Where TxDate < ? And DrCrAccount = ? And AccountLink <> '2' Group By current" #
    cursor = connect.cursor();
    cursor.execute(current , [one_month_ago , counter ]); 
    Xcurrent = cursor.fetchone()
   
How many English words
do you know?
Test your English vocabulary size, and measure
how many words do you know
Online Test
Powered by Examplum