another solution:

DROP TABLE samp;
CREATE TABLE samp AS
SELECT '9-1' act, 300 beg, 350 nd FROM DUAL UNION ALL
SELECT '9-2' act, 350 beg, 310 nd FROM DUAL UNION ALL
SELECT '9-3' act, 310 beg, 301 nd FROM DUAL UNION ALL
SELECT '9-4' act, 301 beg, 340 nd FROM DUAL UNION ALL
SELECT '9-5' act, 340 beg, 330 nd FROM DUAL UNION ALL
SELECT '8-1' act, 399 beg, 350 nd FROM DUAL UNION ALL
SELECT '8-2' act, 350 beg, 610 nd FROM DUAL UNION ALL
SELECT '8-3' act, 314 beg, 301 nd FROM DUAL UNION ALL
SELECT '8-4' act, 301 beg, 111 nd FROM DUAL;

SELECT DISTINCT SUBSTR( act, 1, 1 ),
                FIRST_VALUE( beg ) OVER( PARTITION BY SUBSTR( act, 1, 1 )
                ORDER BY act ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED
FOLLOWING )

bop,
                LAST_VALUE( nd ) OVER( PARTITION BY SUBSTR( act, 1, 1 )
                ORDER BY act ROWS BETWEEN UNBOUNDED PRECEDING AND UNBOUNDED
FOLLOWING )

eop
           FROM samp;

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google
Groups "Oracle PL/SQL" group.
To post to this group, send email to Oracle-PLSQL@googlegroups.com
To unsubscribe from this group, send email to
oracle-plsql-unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/Oracle-PLSQL?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to