List all customer (user id, name, and e-mail), number of charging

List all customer (user id, name, and e-mail), number of charging, total charging,
number of transaction and total number of transaction value?

If u have these tables:

1- 'Credit_card'
columns: credit_number,type,value,Customer_ID.

columns: Coupon_number,value,password,Customer_ID

columns: Customer_ID,Fname,Mname,lname,E_mail,password,bdate,tot_trans,mobil_no,

Questions by mnmlove

Showing Answers 1 - 1 of 1 Answers

Hi, One of the solution is as follow:
select cust.customer_id,fname,mname,lname,e_mail,credit.tot_credit+coupan.tot_coup no_of_recharge,

credit.tot_credit_val+coupan.tot_coup_val tot_recharging,tot_trans,credit.tot_credit_val+coupan.tot_coup_val-current_balance transaction_val,cust.current_balance

from Customer cust ,

(select customer_id,count(value) tot_credit,sum(value) tot_credit_val from credit_card group by customer_id) credit,

(select customer_id,count(value) tot_coup,sum(value) tot_coup_val from coupan group by coupan.customer_id) coupan

where coupan.customer_id=cust.customer_id and cust.customer_id=credit.customer_id;

  Was this answer useful?  Yes

Give your answer:

If you think the above answer is not correct, Please select a reason and add your answer below.


Related Answered Questions


Related Open Questions