select * from (select * from lhg where id=1) a where rownum < 11 union select * from (select * from lhg where id=2) a where rownum < 11 union select * from (select * from lhg where id=3) a where rownum < 11
试了一下,有点问题。 rank1 不能在条件里面直接用。select * from (select itemid,rank() over (PARTITION by type order by itemid) as rank1 from tablename) a where a.rank1<=10
select * from (select * from lhg where id=1) a where rownum < 11 union select * from (select * from lhg where id=2) a where rownum < 11 union select * from (select * from lhg where id=3) a where rownum < 11这种用法不是很好,只能临时用用。 通常这种情况下typeid总是有很多,而且是可变的。在程序里是不可能这么用的。
select * from (select * from lhg where id=1) a where rownum < 11 union select * from (select * from lhg where id=2) a where rownum < 11 union select * from (select * from lhg where id=3) a where rownum < 11 可行,
union
select * from (select * from lhg where id=2) a where rownum < 11
union
select * from (select * from lhg where id=3) a where rownum < 11
rank1 不能在条件里面直接用。select * from
(select itemid,rank() over (PARTITION by type order by itemid) as rank1
from tablename) a
where a.rank1<=10
union
select * from (select * from lhg where id=2) a where rownum < 11
union
select * from (select * from lhg where id=3) a where rownum < 11这种用法不是很好,只能临时用用。
通常这种情况下typeid总是有很多,而且是可变的。在程序里是不可能这么用的。
union
select * from (select * from lhg where id=2) a where rownum < 11
union
select * from (select * from lhg where id=3) a where rownum < 11
可行,