Top 10 records [message #96109] |
Tue, 24 August 2004 23:47 |
raed nofal
Messages: 3 Registered: February 2002
|
Junior Member |
|
|
we have the
following 2 tables:
SQL> desc temp_customer_master
Name Null? Type
------------------------------- -------- ----
CUSTOMER_ID NOT NULL NUMBER --PRIMARY KEY
CUSTOMER_NAME NOT NULL VARCHAR2(50)
CUSTOMER_COUNTRY NOT NULL VARCHAR2(3)
CUSTOMER_STATE NOT NULL VARCHAR2(50)
SQL> desc temp_purchase_order
Name Null? Type
------------------------------- -------- ----
PURCHASE_ORDER_ID NOT NULL NUMBER --PRIMARY KEY
CUSTOMER_ID NOT NULL NUMBER --FOREIGN KEY TO temp_customer_master
PRODUCT_ID NOT NULL NUMBER
QUANTITY NOT NULL NUMBER
PRICE NOT NULL NUMBER
SUBTOTAL NOT NULL NUMBER
TAX NUMBER
ORDER_TOTAL NOT NULL NUMBER
PURCHASE_ORDER_DATE NOT NULL DATE --STORES DATE WITH TIMESTAMP <BR style="mso-special-character: line-break"><BR style="mso-special-character: line-break">
how to List top 10 states by total sales (based on order total) for year 2001.?
|
|
|