执行:
select a.wid, a.hit+b.hit+c.hit hits from tb_bajieword a join tb_bajieword b join tb_bajieword c on a.wid=b.wid and a.wid=c.wid where a.word='开放' and b.word='图片' and c.word='因为' order by hits desc;
得到21个结果
但执行:
select a.wid, a.hit+b.hit+c.hit+d.hit hits from tb_bajieword a join tb_bajieword b join tb_bajieword c join tb_bajieword d on a.wid=c.wid and a.wid=d.wid where a.word='开放' and b.word='图片' and c.word='因为' and d.word='站长' order by hits desc;
却得到了6069个结果肯定是什么地方出问题,请大侠赐教。

解决方案 »

  1.   

    select a.wid, a.hit+b.hit+c.hit hits 
    from tb_bajieword a join tb_bajieword b join tb_bajieword c on a.wid=b.wid and a.wid=c.wid 
    where a.word='开放' and b.word='图片' and c.word='因为' order by hits desc;
    select a.wid, a.hit+b.hit+c.hit+d.hit hits 
    from tb_bajieword a join tb_bajieword b join tb_bajieword c join tb_bajieword d on a.wid=c.wid and a.wid=d.wid 
    where a.word='开放' and b.word='图片' and c.word='因为' and d.word='站长' order by hits desc;
    你多JOIN了一个表,并且没有任何限制。