0

表:

auth(auth, age), book(title,auth,pubname), publ(pubname,address)

我正在尝试提出将打印仅出版一本书的出版商地址的查询,这是我的尝试,如果我错了,请纠正我:这不是家庭作业,它是学习指南的一部分即将到来的测试。

SELECT address 
FROM publ 
WHERE pubname 
  IN ( SELECT pubname 
       FROM book 
       GROUP BY pubname 
         HAVING count(*) = 1)

我认为这是对的,但不确定。

4

1 回答 1

0

通过查询进行内部连接将解决您的问题。

select address from from publ pb 
inner join 
(SELECT pubname 
 FROM   book 
 GROUP BY pubname 
 HAVING count(*) = 1) b
on b.pubname = pb.pubname
于 2013-05-03T04:46:18.433 回答