Sql Select Where Max Function In Python