select * from article,user where article.userid = '1' and article.userid = user.userid or article.userid = '2' and article.userid = user.userid or article.userid = '3' and article.userid = user.userid or article.userid = '4' and article.userid = user.userid  or article.userid = '5' and article.userid = user.userid ORDER BY articleid DESC也就是说,userid 会有很多,请问可以精简吗?

解决方案 »

  1.   

    select * from article,user
    where article.userid = user.userid 
    and article.userid in ('1', '2', '3', '4', '5')
    ORDER BY articleid DESC
      

  2.   

    lz的or and 在一起是什么逻辑
    select * from article,user 
    where article.userid = user.userid or article.userid in ('1','2','3','4','5') 
    ORDER BY articleid DESC
    这样?
      

  3.   

    mysql 里,and 的优先级好像比or 的优先级要高那么一点点
    当然还是推荐写括号
      

  4.   

    哈哈,谢谢大家为我解决问题,问题按照一楼的方案,已经解决了。。谢谢again。