FNZ Interview Question

To optimize an obviously bad SQL query, to code a simple class in C#