I am trying to extract some data from a database, which should be the top 10 agents with the highest result.
My request:
SELECT AgentScores.agentID, AgentScores.totalScore, Agents.firstname, Agents.lastname FROM AgentScores INNER JOIN Agents ON AgentScores.AgentId=Agents.Agent_id ORDER BY AgentScores.totalScore DESC LIMIT 10
Internal connections work. I found a SELECT TOP 10 sql SELECT TOP 10 , but .. I want 10 agents with the highest result, not the first 10 id. As you can see, I order on a total sign.
Does anyone know how to fix this?
Error: Array ( [0] => Array ( [0] => 42000 [SQLSTATE] => 42000 [1] => 102 [code] => 102 [2] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near 'LIMIT'. [message] => [Microsoft][ODBC Driver 11 for SQL Server][SQL Server]Incorrect syntax near 'LIMIT'. ) )
Thanks!
Peurr source share