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
properties and methods for object
Call forwarding from a cell phone
Add data to Access Listbox
Decrease load time of tree in vb.net 2003
emails stuck in outlook outbox, exchange not pop3
Delete Old Exchange Emails
Set focus when AJAX modal popup extender closes
SQL ERROR After Changing VHD size Connection Failed
How Can I Disable Calendar Event Notifications in Entourage 2008?
Access to MAPI "API"