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
sort field based on color
Can you please tell me about the latest Microsoft Certification Exam for ASP.NET/C#/Visual Studio?
VMWare vCenter Server on a VM?
Determine if validated data has already been used
Returning First and Last Rows, grouped by columns.
Drupal - How to alter default organic group form values?
unable to find callback library jcb.dll
Performance counters in VB.net
CSS problem
How can I change the formula of a cell based on the string value in a dropdown?