MySql to MS Access query conversion : <p>I have a mysql query, which I want to use in MS Access. </p>

<pre><code>SELECT company_name, agent_id FROM
( SELECT company_name, agent_id, @rn := IF(@prev = agent_id, @rn + 1, 1) 
  AS rn, @prev := agent_id FROM users 
  JOIN (SELECT @prev := NULL, @rn := 0) AS vars 
  ORDER BY agent_id DESC, company_name)
 AS T1 
 WHERE T1.agent_id is not null and  rn &lt;= 3;
</code></pre>

<p>I have been trying to run it in Access but its throwing the error: "Syntax error in from clause". </p>
