Thanks! Perfect for untested code. I did not think they invented neural interfaces yet, where did you get yours?
Troy
>Try (not tested)
SELECT DISTINCT mt1.name,
> (SELECT COUNT(*) FROM
> (SELECT TOP 5 * FROM maytable mt2 WHERE mt2.name = mt1.name) dt2
> WHERE dt2.status = 'somestatus')
> FROM maytable mt1
>>Having a table:
>> name, status, date
>>
>>How can I get the count of a particular status from the most recent 5 entries (date) for each name? This needs to be a single SQL statement that is passed to SQL Server.