報錯的sql語句sql
①select * from (select t.*,rownum r from (select * from users where 1=1 and pwd=11 order by id asc) t where rownum<=3) where r>=1;ide
執行成功的sql語句it
②select id,name,pwd,email,tel,birthday,grade from (select t.*,rownum r from (select * from users where 1=1 and pwd=11 order by id asc) t where rownum<=3) where r>=1;class
①中的查詢結果集中有rownum僞列,而users表中並不存在此列,故會報數據類型不一致的錯誤email
只需在最外層中把users表中存在的列給過濾出來便可select