select * from optionInfo a
,(********) b
where a.OptionID=b.OptionID注:上面******** 是一个子查询。 返回一列
当select * 的时候没有问题, 不过我改成select a.*就会出现查询超时
大家看看有么有遇到这种情况? 或者知道是什么原因造成的

解决方案 »

  1.   

    试试select a.* from optionInfo a
     inner join (********) b
    on a.OptionID=b.OptionID
      

  2.   

    当select * 的时候没有问题, 不过我改成select a.*就会出现查询超时?------------
    應該不會出現樓主的情況,樓主選中語句查看執行計劃
      

  3.   

    试试这个select a.* from optionInfo a
    left join (********) b
    on a.OptionID=b.OptionID
      

  4.   


    if object_id('tt') is not null
    drop table tt
    if object_id('tb') is not null
    drop table tb
    go
    Create table tt(id int,Num decimal(15,5))
    Create table tb(id int,Num decimal(15,5),pID int)
    go
    insert into tt
    select 1,0 union all
    select 2,0 union all
    select 3,0 union all
    select 4,4 
    insert into tb
    select 1,0,1 union all
    select 2,0,1 union all
    select 3,0,1 union all
    select 4,4,1 
    go
    select a.* from tb a ,(select top 1 id from tt) b
    where a.pID= b.idselect * from tb a ,(select top 1 id from tt) b
    where a.pID= b.id--感觉没有区别啊
      

  5.   

    语句没错,建议对OptionID建立索引.
      

  6.   

    select * 是查的a和b所有的列 而select a.*只查询了a中的列 只会变快 不会变慢 楼主仔细确认一下
    我感觉 很多觉得不可能发生的事情 最终原因都是有些地方疏漏了