有如下sql语句
select top 5 S.*, R.Hits,SectionName from BBS_Sections S Inner Join (select top 5 SectionID,Hits from BBS_Refers order by Hits desc) R On S.SectionID = R.SectionID
我想把top 5 S.*换成这样的形式:
('BBS_ReferList.aspx?SectionId='+ CAST(SectionID as varchar(14))) as S.*但是报错!不知该怎么办?顺便问下,怎么给大家分?

解决方案 »

  1.   

    BBS_Sections 这是s表
    设个变量 然后再赋值 
    给分点该页面右上角的管理 然后填写你ID的密码 就能给分了~
      

  2.   

    ('BBS_ReferList.aspx?SectionId='+ CAST(SectionID as varchar(14))) as S.* 
    ======>>>
    ('BBS_ReferList.aspx?SectionId='+ CAST(S.SectionID as varchar(14))) as XXXS.*随便换成个别的什么名
      

  3.   

    S.*表示你要查S的所有字段,这种T_SQL认为有意义的字符,放到as后面会报错的吧
    你随便AS个T_SQL不会以为有特殊意义的字符的可以啦