drop table a
drop table b
drop table c
go
create table a (id int)
insert into a
select 1 union 
select 2 union 
select 3 union 
select 4 union 
select 5create table b(id int,name int)
insert into b
select 1,11 union 
select 2,22 union 
select 13,33 union 
select 14,44 union 
select 15,55
create table c(name int)
insert into c
select 11 union 
select 23 union 
select 133 union 
select 144 union 
select 155select *
from (select a.id
from a join b on a.id=b.id
join c on b.name=c.name ) d
这个语句为什么在查询分析器中没返回结果呢,只是提示命令完成不是有select *
from   这语句吗?

解决方案 »

  1.   


    select * 
    from (select a.id 
    from a a join b b on a.id=b.id 
    join c c on b.name=c.name ) d 
      

  2.   

    当 SET NOCOUNT 为 ON 时,不返回计数(表示受 Transact-SQL 语句影响的行数)。 只显示:命令已成功完成。
    当 SET NOCOUNT 为 OFF 时,返回计数。 会显示:
    (5 行受影响)(5 行受影响)(5 行受影响)(1 行受影响)
    如果存储过程中包含的一些语句并不返回许多实际的数据,则该设置由于大量减少了网络流量,因此可显著提高性能。