select top 20 * from topic where boardId=" + boardId
+ " and topicId not in(select top " + rowBegin
+ " topicId from topic where boardId=" + boardId
+ " order by publishTime desc) order by publishTime desc 

解决方案 »

  1.   

                                    select  * from topic where boardId=" + boardId
    + " and topicId not in(select top " + rowBegin
    + " topicId from topic where boardId=" + boardId
    + " order by publishTime desc) order by publishTime desc limit 20
      

  2.   

    McGosling (McGosling)
      '截至2011-05-18 21:49:55  用户结帖率0.00% 当您的问题得到解答后请及时结贴.
    http://topic.csdn.net/u/20090501/15/7548d251-aec2-4975-a9bf-ca09a5551ba5.html
    http://topic.csdn.net/u/20100428/09/BC9E0908-F250-42A6-8765-B50A82FE186A.html
    http://topic.csdn.net/u/20100626/09/f35a4763-4b59-49c3-8061-d48fdbc29561.html8、如何给分和结贴?
    http://community.csdn.net/Help/HelpCenter.htm#结帖
      

  3.   

    你帮我改的那个括号你都没做任何改动呢!还有我顺着你的该法改了括号里的得到如下异常:This version of MySQL doesn't yet support 'LIMIT & IN/ALL/ANY/SOME subquery' 该怎样用mysql实现我在1楼的那个语句所实现的功能呢?
      

  4.   

    建议你还是直接贴出你的SQL语句,而不是这种java中的代码。
      

  5.   

    只需要把top 20改成limit 20即可