Last active
December 15, 2015 11:29
-
-
Save catlion/5253184 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
declare @max_mrdate datetime | |
declare @max_nexteval datetime | |
select | |
@max_mrdate=max(cast(mrdate as datetime)), | |
@max_nexteval=max(cast(nexteval as datetime)) | |
from tblpms | |
where CaseNo = 'TR13-011-CRW' | |
select * | |
from tblpms where CaseNo = 'TR13-011-CRW' | |
and ( | |
(med_stat is not null and cast(mrdate as datetime) = @max_mrdate) | |
or | |
(mrprocedure is not null and cast(nexteval as datetime) = @max_nexteval) | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment