Created
August 13, 2015 15:46
-
-
Save coreyjs/a606457e3becabded7b4 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
select order_Id from [order] o where( | |
o.order_id in ( | |
select osh.order_id | |
from order_status_history osh | |
join order_status os on os.status_id = osh.status_id | |
inner join ( | |
select order_id, MAX(effective_date) as updated | |
from order_status_history | |
group by order_id) as status on osh.order_id = status.order_id and osh.effective_date = status.updated | |
where (os.code in ( 'cart')))) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment