Avoid using LIMIT in a subquery

[TIM-380](https://edx-wiki.atlassian.net/browse/TIM-380)

@ormsbee @stephensanchez