大家帮我看下这两条语句有错没啊?应该怎么改?
1、select * from usertab where userid not in (select * from usertab where rownum =<3 order by userid)
2、select * from (select * from usertab order by userid)where rownum =<3
为啥我执行不了?
1、select * from usertab where userid not in (select * from usertab where rownum =<3 order by userid)
2、select * from (select * from usertab order by userid)where rownum =<3
为啥我执行不了?
2,rownum=<3改成 rownum<=3
1、select * from usertab where userid not in (select userid from usertab where rownum <3 order by userid)
2、select * from (select * from usertab order by userid) where rownum <3
还是有错啊。。
全是ORA-00907:缺少右括号 错误
你不会是把两句放一起运行吧,而且中间没加分号?
第一句需要改下
select * from usertab where userid not in (select * from(
select userid from usertab order by userid)
where rownum <3)
还有你的代码我也运行了一下,还是不行,仍是那个错误
会不会是我oracle版本不支持啊?我的是oracle 8.0
都说了你的右括号是 中文的右括号,不是英文下输入的右括号!还不明白啊,把)这个copy上去不就好了!
别的也都是最基本的东西
select * from (select * from test_a order by name) where rownum <3
--结果
NAME SEX OFFICE JG DZ YB XL
何兴建 男 学校 江西省 北京 000004 否
何兴建 男 学校 江西省 北京 000004 否--运行正常你刚开始的代码,第二句里确实右边那个括号是中文的
3楼里改正过来了。你只运行这句试试,应该没有问题的
看到了啊,呵呵,你放个别名,试试看:select a.* from (select * from usertab order by userid)a where rownum <3