|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
Select 2 latest dates
I need to select 2 latest patients' tests.
For example, patientID date testID A 01/01/2004 5 A 05/05/2004 5 A 10/10/2004 5 Result should be (2 last tests): A 05/05/2004 5 A 10/10/2004 5 Does anyone have any idea how to do this? |
|
#2
|
|||
|
|||
|
sort decending(by date) and take top 2
Select Top 2 * Order By Date Desc |
![]() |
| Viewing: Dev Articles Community Forums > Databases > General SQL Development > Select 2 latest dates |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|