SQL most recent order? MS SQL
<p>Im just writing a query to look through my clients customers database and to list how many orders they have made etc. </p>

<p>What I'm struggling to add into this query is to only show me most recent OrderID for that email</p>

<p>Any ideas?</p>

<p>Here is my query</p>

<pre><code>select top 1000 
     BuyerEMail
     ,COUNT(*) HowMany
     ,Name
from Orders 
where 
     Pay != 'PayPal'
group by 
     BuyerEmail
     ,Name
order by 
     HowMany Desc
</code></pre>