complex SQL query, best way to simplify it

Printable View