select TBL_TOPIC.* from TBL_TOPIC
where boardId=1
and topicId not in (select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime)
and rownum <20 order by publishTime
提示缺失右括号
把子查询提取查询结果写入not in()中没有问题
select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime查询结果1,2select TBL_TOPIC.* from TBL_TOPIC
where boardId=1
and topicId not in (1,2)
and rownum <20 order by publishTime
正确请问怎么回事啊?
where boardId=1
and topicId not in (select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime)
and rownum <20 order by publishTime
提示缺失右括号
把子查询提取查询结果写入not in()中没有问题
select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime查询结果1,2select TBL_TOPIC.* from TBL_TOPIC
where boardId=1
and topicId not in (1,2)
and rownum <20 order by publishTime
正确请问怎么回事啊?
解决方案 »
- 关于oracle数据库,更改数据库名称的问题:
- 有关于存储过程?在线!
- 关于ORACLE 插入Long 问题!
- 求Oracle表结构设计的问题,高手过来看看!
- 特急oracle安装问题:不能创建数据库,其他一切正常,这是怎么回事?
- 各位帮忙看看:一个本论坛里好像从来没彻底坚决过的问题:用sql server的dts导出数据到oracle时:用户“**”不存在,表或视图不存在
- ora-12801
- 关于regexp_substr 截取
- oracle中可以实现动态字段名么
- oracle dg临时表空间添加临时文件问题
- 求条SQL语句~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- 一起探讨:距今超过10年的工龄的员工?
select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime
去掉order by publishTime就可以了
还有,如果rownum<=1,可以不使用not in了。
where boardId=1
and topicId not in (select topicId from TBL_TOPIC where boardId=1 and rownum<=1 order by publishTime)
and rownum <20 order by publishTime
--楼上所说不能在子查询中使用order by语句
--本人看了你的语句的意思写了下面的语句.
select * from (select TBL_TOPIC.* ,rownumn rn from TBL_TOPIC
where boardId=1 and rownum <20
order by publishTime) a
where rn between 2 and 19