日期:2014-05-16  浏览次数:20447 次

oracle查询一张表中各种类行数据的前20行
查询TB_XBE_ITEM表中temp1等于M和N的数据,分别前20行数据,并且根据ID排序
关键的词union连接

select * from tb_xbe_item where id in((select id from (select * from tb_xbe_item where temp1='M' order by id desc) where rownum<21) union (select id from (select * from tb_xbe_item where temp1='N' order by id desc) where rownum<21 ))