And there is an answer to that. The idealistic answer is good DB design from the start. The realistic answer is by using views (sometimes materialized views) to create a clean representation out of odd tables.
The monster query can be decomposed into simple and clean operations against these views (and if necessary, views upon views).
The only caveat is you need a SQL expert to understand the performance if you want to do this at scale.