more tests and nested joins + nested conditions