日期:2014-05-18  浏览次数:20490 次

请各位大侠看看。。。。。。。。。。。
11.查询是否所有的玩具都曾经被人订购,如果是的话,
那么打印消息‘All Toys have ever been ordered’。
否则,打印消息‘Some kind of toys are not so popular ’,
并列出没有被人订购过的玩具的详细信息。
   
  if exists (select cToyId from OrderDetail where cToyId !=ALL (select cToyId from Toys) )
  print 'All Toys have ever been ordered' 
  else
  begin
  print 'Some kind of toys are not so popular '
  select * from Toys where cToyId not in(select cToyId from OrderDetail )
  end

运行结果: 只是显示没有被人订购过的玩具的详细信息的表,
  为什么没有打印'Some kind of toys are not so popular '?


------解决方案--------------------
因为打印的信息在“消息”选项卡里面,不在“结果”选项卡里面
------解决方案--------------------
lz:基于你的问题的解答:

print :这个是输出到输出窗口

select :这个是输出到查询窗口

把你的print换成select就行了。你就可以看到他们了,但这还不在同一个窗格内,不过你可以看到了。

希望楼主成功。