select title,type,price,pub_id
from titles
where exists (select 1 from publishers where pub_name like 'new moon%' and titles.pub_id>pub_id)
from titles
where exists (select 1 from publishers where pub_name like 'new moon%' and titles.pub_id>pub_id)
from titles
where pub_id>(select pub_id from publishers where pub_name like 'new moon%')
我是教科书上讲的。
大力的命令是没有问题。
教科书的错在什么地方啊?
select title,type,price,pub_id from titles where pub_id>(select pub_id from publishers where pub_name like 'new moon%')
这样写是只能比较子查循返回一条记录的情况,多条就错了!你的书可以丢掉了,哈哈。。开玩笑!
use pubs
go
select title,type,price,pub_id from titles where pub_id>(select pub_id from publishers where pub_name like 'new moon%')