select url from
(
select query, url, count(*) cnt, sum(decode(test_id, 17294, 1, 0)) test1, sum(decode(test_id, 17374, 1, 0)) test2 from
(
select b.query ,a.url url,a.test_id from rel_url_score a, rel_query b where a.test_id=17294 and b.test_id=17294 and a.query_id=b.id
union all
select d.query ,c.url url,c.test_id from rel_url_score c, rel_query d where c.test_id=17374 and d.test_id=17374 and c.query_id=d.id
)
group by query,url having count(*) =1
)
where test2 !=0
|