sql getting data three columns from one table and one from another -
i have 2 tables sales , customers 1st table want sum 2 columns recived_amount , bill_amount , subtract them both , after want customer_id
from 2nd table want customer_name
i've tried
select customer_details.cus_name, sum(sales.bill_amount) - sum(sales.recived_amount), customer_details.cus_id sales inner join customer_details on customer_details.cus_id=sales.cus_id sales.cus_id = 1 order cus_id
select customer_details.cus_name, (sum(sales.bill_amount) - sum(sales.recived_amount)) subtract,customer_details.cus_id sales inner join customer_details on customer_details.cus_id=sales.cus_id sales.cus_id = 1 group customer_details.cus_name,customer_details.cus_id order cus_id
Comments
Post a Comment