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
Separate SSIS server for ETL Tasks
Is it safe to move Exchange log files to another drive directory?
Global Error Handler and On Error Resume Next
Can Sharepoint 2010 do this?
exchange user with corrupted mailbox
Lenovo monitor driver for Machine types 4420-HB2 issue
Factory Default setting on a Catalyst 1900 cisco switch
Who is out of the office next week?
How does Java handle language translations?
How to set the time format in a Web Intelligence document