select * from IMD_WMQ_SF_OUT where rownum<5; select entry_station, entry_lane, sum(total_toll) from IMD_WMQ_SF_OUT where rownum<20 group by grouping sets(entry_station, entry_lane) ----------------------------------------------------- ---grouping sets(entry_station, entry_lane) 等价-- ---------------------------------------------------- select * from ( select entry_station, null, sum(total_toll ) from IMD_WMQ_SF_OUT group by entry_station union all select null, entry_lane, sum(total_toll ) from IMD_WMQ_SF_OUT group by entry_lane ) -------------------------------------------------------------- select entry_station,entry_lane,sum(total_toll) from IMD_WMQ_SF_OUT group by rollup(entry_station,entry_lane) ---等效--- select * from (select entry_station,entry_lane,sum(total_toll) from IMD_WMQ_SF_OUT group by entry_station,entry_lane union select entry_station,null,sum(total_toll) from IMD_WMQ_SF_OUT group by entry_station union select null,entry_lane,sum(total_toll) from IMD_WMQ_SF_OUT group by entry_lane union select null,null,sum(total_toll) from IMD_WMQ_SF_OUT) ----------------------------------------------------------- select entry_station,entry_lane,sum(total_toll) from IMD_WMQ_SF_OUT where rownum<100 group by cube(entry_station,entry_lane)