title: Why this code works well in MySQL but not in SQL Server?
body: <p>This is a question in Leetcode: <a href="https://leetcode.com/problems/delete-duplicate-emails/solution/" rel="nofollow noreferrer">https://leetcode.com/problems/delete-duplicate-emails/solution/</a></p>
  
  <p>Basically the question asks to delete duplicate emails and keep the one that has the minumal index.</p>
  
  <p>My code is the following one, and I firstly ran it in <strong>SQL Server</strong> mode, and it shows "Internal Error". But it has passed in <strong>MySQL</strong> mode. Why does this happen? Are there any syntax differences between them shown in this case? Thanks.</p>
  
  <pre><code>delete from Person
  where Id not in (
  select temp.minimum from 
  (select min(Id) as minimum from Person group by Email) as temp
  );
  </code></pre>