Changes for getting second agent in statistics
Adjusted to add company qualifier on where clause and sales sub queries.