Click here to Skip to main content
15,907,329 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi,

In my report i'm using inner join in queries .I got correct record but itz repeated.How to deduct that repeat values?.Please check my query itz working.


SQL
SELECT f.feeid,
       f.studentid,
       ( s.first_name + last_name )AS studentname,
       b.branchname,
       c.coursename,
       y.yearname,
       se.sectionname,
       sem.semester,
       f.paymentmode,
       f.typeoffee,
       f.nameofthebank,
       f.totalfee,
       f.t                         otalpaidfee,
       f.balancefee,
       f.feestatus
FROM   studentfeedetails1 f
       inner join studentdetails s
         ON s.studentid = f.studentid
       inner join branchdetails b
         ON b.branchcode = s.branchcode
       inner join coursedetails c
         ON c.coursecode = s.coursecode
       inner join year_table y
         ON y.yearid = s.yearid
       inner join semester_table sem
         ON sem.semesterid = s.semesterid
       inner join section_table se
         ON se.sectionid = s.sectionid
WHERE  b.branchname = 'CSE'
       AND c.coursename = 'B-TECH'
       AND y.yearname = 'I'
       AND sem.semester = 'I'
       AND se.sectionname = 'A'
       AND f.typeoffee = 'Tution Fee
Posted
Updated 17-Dec-11 20:32pm
v3

 
Share this answer
 
Comments
Hari Krishna Prasad Inakoti 18-Dec-11 1:16am    
itz not working...
thatraja 18-Dec-11 1:20am    
Try all those 3 links in my answer...step by step.
Hari Krishna Prasad Inakoti 18-Dec-11 1:30am    
i applied that properties but itz not working.i'm using innerjoin for 4 tables
Hari Krishna Prasad Inakoti 18-Dec-11 1:32am    
I'm using this query:

SELECT f.feeid,
f.studentid,
( s.first_name + last_name )AS studentname,
b.branchname,
c.coursename,
y.yearname,
se.sectionname,
sem.semester,
f.paymentmode,
f.typeoffee,
f.nameofthebank,
f.totalfee,
f.t otalpaidfee,
f.balancefee,
f.feestatus
FROM studentfeedetails1 f
inner join studentdetails s
ON s.studentid = f.studentid
inner join branchdetails b
ON b.branchcode = s.branchcode
inner join coursedetails c
ON c.coursecode = s.coursecode
inner join year_table y
ON y.yearid = s.yearid
inner join semester_table sem
ON sem.semesterid = s.semesterid
inner join section_table se
ON se.sectionid = s.sectionid
WHERE b.branchname = 'CSE'
AND c.coursename = 'B-TECH'
AND y.yearname = 'I'
AND sem.semester = 'I'
AND se.sectionname = 'A'
AND f.typeoffee = 'Tution Fee
thatraja 18-Dec-11 1:40am    
Are you sure multiple row values are duplicate? I mean all column values are equal same as another row
It is very obviously an error in your application there are two records matching your join criteria. One record has the status "due" and the other one "paid". I suspect you would want to update the record containing the status details instead of inserting a new record, but that is for you to decide.

Regards,

Manfred
 
Share this answer
 

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