Microsoft
Software
Hardware
Network
Question : Grab last two lab results
I need to grab the last two lab results from a table by date. How do I do this? I can grab max but not sure how to grab the last two. If there are 10 results I just want the last two
Answer : Grab last two lab results
select * from
(
select *,
rn=row_number() over (partition by patientid order by date desc) -- rank for each patient by latest date
from tbl
) SQ
where rn<=2 --- only top 2
Random Solutions
Help formating a output in Powershell
How do i find all of the emails sent to a mail list in Exchange 2003
Restoring information store Exchange 2003
Print 'Incomplete' for crystal report subtotal if any detail records are zero
Touch controls for Windows Mobile / C# / .NET Compact Framework?
Sending 'Test' Messages
SQL Server 2005 Casting behaviour
Development setup for PHP/MYSQL and ASP/MSSQL.
outlook 2003 - pop3 email keep crashing
Windows 7 Sleep Issues