Permalink
Browse files

fix row number bug

  • Loading branch information...
1 parent beb5cf3 commit 949a62652e0f0174a871a6509a48ddf67d34c583 @alistairewj alistairewj committed May 19, 2017
Showing with 1 addition and 1 deletion.
  1. +1 −1 concepts/code-status.sql
View
@@ -10,7 +10,7 @@ with t1 as
select icustay_id, charttime, value
-- use row number to identify first and last code status
, ROW_NUMBER() over (PARTITION BY icustay_id order by charttime) as rnFirst
- , ROW_NUMBER() over (PARTITION BY icustay_id order by charttime) as rnLast
+ , ROW_NUMBER() over (PARTITION BY icustay_id order by charttime desc) as rnLast
-- coalesce the values
, case

0 comments on commit 949a626

Please sign in to comment.