WQL SQL error about limit and found_by?+discussion
same issue as this: star-count not working on one card.
You can't have a limit on a subquery, at least in mysql (dunno about postgres). "Subquery" in both WQL and SQL means a query nested inside another. So "limit" can only be used on the outermost query.
Solution: strip limits from WQL subqueries.
Workaround: don't use limits in subqueries :)