Created
July 20, 2017 04:14
-
-
Save stompro/ca50f835142646f71691b4ac40473608 to your computer and use it in GitHub Desktop.
Evergreen actor.card adding creation date and time
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
-- Use history to find the date and staff member that changed the card | |
select * from ( | |
select aauh.audit_id, aauh.audit_time, aauh.audit_user, aauh.card, aauh.id | |
,lead(aauh.card) OVER (PARTITION BY aauh.id ORDER BY aauh.audit_time) as next_card | |
from auditor.actor_usr_lifecycle aauh | |
where aauh.id > 112900 | |
--and aauh.id=124212 | |
order by aauh.id, aauh.audit_time | |
--limit 10000 | |
) x | |
where | |
( x.card!=x.next_card ) | |
; | |
-- Test case | |
select * | |
from auditor.actor_usr_lifecycle aaul | |
where | |
id=124212 | |
order by audit_time | |
; | |
-- Test Case | |
select * from actor.card where usr=124212; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment