【发布时间】:2020-09-15 00:49:45
【问题描述】:
【问题讨论】:
-
你很幸运,你得到了答案(而且做得很好)。通常你应该先自己尝试一下,然后询问是否卡住。
-
请不要破坏这个问题,我把它回滚到以前的版本。
标签: sql oracle select oracle-sqldeveloper qsqlquery
【问题讨论】:
标签: sql oracle select oracle-sqldeveloper qsqlquery
您可以使用exists 和not exists:
select t.*
from tourists t
where
exists (
select 1
from stay s
inner join hotels h on h.hcode = s.hcode
where s.tcode = t.tcode and h.name = 'Hilton'
) and not exists (
select 1
from stay s
inner join hotels h on h.hcode = s.hcode
where s.tcode = t.tcode and h.name = 'Continental'
)
【讨论】: