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
How to diagnose and fix a messed up keyboard
Can't Uninstall Exchange Server 2007 SP1 from 2008 server R2
Creat textbox(s) in Excel to enter 3 sets of numbers and then store them joined in one cell
Exchange OAB
Logshipping is failing when SQL Server 2008 cluster is failed over
How to format a message in javascript
Cannot install ISA 2006, get error “A Connection to the specified Configuration Storage Server"
Find and export contacts by value in Account entity
Yes/No query parameter for MS Access Report
HP Designjet 9000s Printer Driver for Windows 7 x64