If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ANSI SQL > Average query

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 04-20-04, 17:28
Rajen Rajen is offline
Registered User
 
Join Date: Apr 2004
Location: Los Angeles, CA
Posts: 4
Average query

I need help to write a one SQL query. Following are the table name and column name for Oracle Receivable.



Table Column Name

RA_CUSTOMER_TRX_ALL bill_to_customer_id

cust_trx_type_id



Now, my task is to get average number of transaction types per customer, minimum number of transaction type per customer, maximum number of transaction type.



bill_to_customer_id cust_trx_type_id

1041 1020

1041 1021

1043 1020

1043 1021

1043 1023

1045 1023

1045 1027

1047 1020

1050 1027

1050 1021

---- ----

---- ----

---- ----

For above example, customer 1041 has 2 transaction type used, 1043 has 3 used, I am looking for all customer average how many transaction type used.
Now, I am looking for following type of result.

Average 1.25 transaction type used per customer

Minimum 1.0 transaction type used for customer

Maximum 4.0 transaction type used for customer
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On