关于oracle 语句,in 的用法
问题描述:
关于oracle 语句,in 的用法
我有一堆数据大概有几万条,按照时间排序的.现在我想取其中的8000条,取升序6000条,降序2000条.就是取头和尾的.但是我这样写报错
SELECT sbsfz,sbxm,zdbh,CJBH FROM cc_compare WHERE yhbz='06' AND vhdbz='0' AND cjzt='100' and zjlx='1' AND length(sbsfz)=18 and sbsfz in (SELECT sbsfz FROM cc_compare WHERE yhbz='06' AND vhdbz='0' AND cjzt='100' and zjlx='1' AND length(sbsfz)=18 AND ROWNUM
英语人气:435 ℃时间:2020-09-25 02:51:29
优质解答
你的写法效率很低的
select * from
(SELECT sbsfz,sbxm,zdbh,CJBH
FROM cc_compare
WHERE yhbz='06' AND vhdbz='0' AND cjzt='100' and zjlx='1' AND length(sbsfz)=18 and
order by cjpc asc)
where rownum
select * from
(SELECT sbsfz,sbxm,zdbh,CJBH
FROM cc_compare
WHERE yhbz='06' AND vhdbz='0' AND cjzt='100' and zjlx='1' AND length(sbsfz)=18 and
order by cjpc asc)
where rownum
我来回答
类似推荐
答
你的写法效率很低的
select * from
(SELECT sbsfz,sbxm,zdbh,CJBH
FROM cc_compare
WHERE yhbz='06' AND vhdbz='0' AND cjzt='100' and zjlx='1' AND length(sbsfz)=18 and
order by cjpc asc)
where rownum