Click here to Skip to main content
14,691,895 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i have two table named feeDetails and feeQuotations with two column same ie student_ID and Fee_Type.......

i want to display values from both the tables with joins..
Now how to find duplicate fee_type and sum the amount ....displays only one time with total value....
I want write query in procedure...

plz help....
Posted
Comments
Herman<T>.Instance 2-Apr-13 6:31am
   
what have you tried?
Mike Meinz 2-Apr-13 6:41am
   
What is the DDL for your tables?
What does your current SELECT statement look like?

Your question seems more like a request to write code for you than a request for help with your code.
akrati shakya 2-Apr-13 6:46am
   
i want to use select query with joins,where clause,and with group by...but how...?

1 solution

Hi,

try below query
SELECT DISTINCT(A.fee_Type) 'FeeType', SUM(B.amount) 'Amount' FROM 
feeDetails A INNER JOIN feeQuotations B ON A.fee_Type = B.fee_Type and A.StudentID = B.StudentID
GROUP BY A.fee_Type 


hope it works.
   
Comments
Maciej Los 2-Apr-13 10:58am
   
+5
Karthik Harve 3-Apr-13 0:05am
   
Thanks Los.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)




CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900