17,382
社区成员




select 1 from dual having count(1) = 1;
--书
create table book as
select 1 id,'小说A' name from dual union all
select 2 , '小说B' from dual union all
select 3 , '小说C' from dual;
--用户读那本书
create table book_reader as
select 111 id, 1 bookid from dual union all
select 112 , 1 from dual union all
select 113 , 2 from dual ;
--只有一个用户读的书
select *
from book a
where exists (select 1
from book_reader b
where a.id = b.bookid
having count(1) = 1);