SQL help

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.

Other related posts: