更改下:
select  count(*)  from  table1  as  t1  inner  join  table2  on  t1.uID=table2.uID  inner  join  containstable(table1,Content,@Keywords)  as  t3  on  t1.ID=t3.[KEY]

解决方案 »

  1.   

    http://topic.csdn.net/t/20031017/11/2365596.html
      

  2.   

    这个就是搜索地址:http://search.178b2b.com/sell.aspx?keywords=%D6%C6%C0%E4%BC%C1
    查询起来比较慢
      

  3.   

    其中 table1 中的ID 和 table2 中的uID都是主键
      

  4.   

    select ID from table1 as t1 inner join table2 on t1.uID=table2.uID inner join containstable(table1,Content,@Keywords) as t3
    on t1.ID=t3.[KEY] order by t3.[RANK] desc,t1.AddTime desc修改一下,table2有意义么?就查询ID来说应该无意义,去掉。
      

  5.   

    怎么没意义?我要通过uID联合查询,数据要从2个表中取出
      

  6.   

    不好意思,我这个过程没写全。你开始看的那个table2确实没有用,我省掉了一部分,其实要用到table2的,比如table2中有公司名,我要筛选相同的,就要用到table2
      

  7.   

    insert into @indextable(nid) select top 10 ID from table1 as t1 inner join containstable(table1,Content,@keywords) as t3 on t1.ID=t3.[KEY] inner join table2 on t1.uID=table2.uID and t1.ID in
    (select max(table2.ID) from table1 as t1 inner join table2 on t1.uID=table2.uID 
    inner join containstable(table1,Content,@Keywords) as t3 on t1.ID=t3.[KEY] group by CName) order by t2.[rank] desc,t1.addtime desc
    insert into @indextable(nid)select ID from table1 as t1 inner join containstable(table1,Content,@keywords) as t3 on t1.ID=t3.[KEY] where NOT EXISTS(SELECT nid from @indextable where nid=ID) order by t3.[rank] desc,t1.addtime desc
    ......
    ......