a more advanced query, searching with joins