Oracle FAQ Your Portal to the Oracle Knowledge Grid
HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US
 

Home -> Community -> Mailing Lists -> Oracle-L -> SQL help

SQL help

From: Roger Xu <Roger.Xu_at_dp7upbg.com>
Date: Thu, 24 Aug 2006 14:33:48 -0500
Message-ID: <A6801E8A03316A4DA597866F77A013F7095E776B@irv2kexch01.tx.bg.corp>


SQL> select CUSTOMER_NUMBER,INVOICEDATE
  2 from order_history
  3 order by CUSTOMER_NUMBER,INVOICEDATE;  

CUSTOMER_N INVOICEDA
---------- ---------

1137065    10-AUG-06
1137065    10-AUG-06
1137065    17-AUG-06
1137065    17-AUG-06
1137065    18-AUG-06
1137065    18-AUG-06
1137065    21-AUG-06
1137065    22-AUG-06
1137599    19-AUG-06
1137599    19-AUG-06
1137599    20-AUG-06
1137599    20-AUG-06
1137599    22-AUG-06
1137599    22-AUG-06
1137599    23-AUG-06
1137599    23-AUG-06
 

16 rows selected.  

How do I modify this SQL to find out the last 3 invoiceDATE for each customer without using PL/SQL?  

CUSTOMER_N INVOICEDA
---------- ---------

1137065    18-AUG-06
1137065    21-AUG-06
1137065    22-AUG-06

1137599    22-AUG-06

1137599 23-AUG-06
1137599 23-AUG-06   Thanks,  

Roger

This e-mail is intended solely for the person or entity to which it is addressed and may contain confidential and/or privileged information. Any review, dissemination, copying, printing or other use o



This email has been scanned for all viruses by the MessageLabs Email Security System.
--
http://www.freelists.org/webpage/oracle-l
Received on Thu Aug 24 2006 - 14:33:48 CDT

Original text of this message

HOME | ASK QUESTION | ADD INFO | SEARCH | E-MAIL US