本帖最后由 setoy 于 2015-02-06 15:11:52 编辑

解决方案 »

  1.   

    select a.* from article as a left join art_tags at on at.aid=a.aid where at.tid=2
      

  2.   


    at.tid=2  ? 这个没法事先得知的啊。用户输入的是汉字“技术”
      

  3.   


    select * from article where aid in(select aid from art_tags where tid in(select tid from tags where tname='技术'));
      

  4.   

    select a.* from article a 
    left join art_tags b on a.aid=b.aid 
    left join tags c on c.tid=b.tid where b.tname='技术' 
      

  5.   

    谢谢!
    原来where也可以这么写