Reduce the number of joins needed in customer bought query. Closes #3368.