SELECT *
  FROM ( SELECT id, tgl, ket,  row_number() OVER
               (PARTITION BY id ORDER BY tgl DESC ) as rn
          FROM (SELECT * FROM t1))
 WHERE rn<=2;

ferry sends.

----- Original Message -----
From: "Bontor TP." <[EMAIL PROTECTED]>
To: <[email protected]>
Sent: Thursday, September 22, 2005 11:51 AM
Subject: [indo-oracle] [HELP] Returning 2 Recent (by Tgl) Records


> Dear Oracle Member Milis,
>
> Saya punya records sbb,
>
> ID_NO TGL       KET
> ----- --------- ---------------------
>     1 01-AUG-05 Bulan Ketiga
>     1 01-JUL-05 Bulan Kedua si 1
>     1 01-JUN-05 Bulan Pertama
>     2 01-SEP-05 Bulan Selanjutnya
>     2 01-JUL-05 Bulan Kedua
>     2 01-MAR-05 Bulan Kedua
>     2 01-JAN-05 Bulan Kedua
>
> Saya ingin meng-query dua record dgn tgl terbaru untuk tiap tiap id_no.
> Sehingga saya mengharapkan hasil yang ditampilkan menjadi:
>
> ID_NO TGL       KET
> ----- --------- ----------------------
>     1 01-AUG-05 Bulan Ketiga
>     1 01-JUL-05 Bulan Kedua si 1
>     2 01-SEP-05 Bulan Selanjutnya
>     2 01-JUL-05 Bulan Kedua
>
> Gimana ya query-nya
>
> Mohon bantuan dari teman2, "ASAP"
>
> Thanks in Advanced,
>
> Dean
>
> __________________________________________________
> Do You Yahoo!?
> Tired of spam?  Yahoo! Mail has the best spam protection around
> http://mail.yahoo.com
>
> [Non-text portions of this message have been removed]
>
>
>
>
> --
> -----------I.N.D.O - O.R.A.C.L.E---------------
> Keluar: [EMAIL PROTECTED]
> Website: http://indo-oracle.lizt.org (NEW)
> -----------------------------------------------
>
> Bergabung dengan Indonesia Thin Client User Groups,
> Terminal Server, Citrix, New Moon Caneveral, di:
> http://indo-thin.vze.com
> Yahoo! Groups Links
>
>
>
>
>
>



------------------------ Yahoo! Groups Sponsor --------------------~--> 
Most low income households are not online. Help bridge the digital divide today!
http://us.click.yahoo.com/cd_AJB/QnQLAA/TtwFAA/PhFolB/TM
--------------------------------------------------------------------~-> 

--
-----------I.N.D.O - O.R.A.C.L.E---------------
Keluar: [EMAIL PROTECTED]
Website: http://indo-oracle.lizt.org (NEW)
-----------------------------------------------

Bergabung dengan Indonesia Thin Client User Groups, 
Terminal Server, Citrix, New Moon Caneveral, di:
http://indo-thin.vze.com 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/indo-oracle/

<*> To unsubscribe from this group, send an email to:
    [EMAIL PROTECTED]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
 



Kirim email ke