select * from article where boardId='***' and postDate>'***' order by postDate limit 1

解决方案 »

  1.   

    呵呵,我没有说明白,我想问的是如果在给定一个articleId情况下,查询跟它在同一个版块的上一篇和下一篇文章。
      

  2.   

    我有一个写法,如下(这里假设articleId=5):
    select  *  from  article
      where boardId in
      (select boardId from article where articleId=5)
      and postdate >(select postDate from article where articleId=5 order  by  postDate) limit  1好像这样效率不是很高,这个语句会在JDBC中运行。