SQLTeam.com | Weblogs | Forums

Why i am getting duplicate in join



Hi ,

I have problem in fetching record in sql using join.If i have three table and two table contain duplicate record of first table then i am getting duplicate record .I want to avoid those duplicate record.

I attached problem image which describe my problem better.Please give me suggestion.How can i come out this problem?

thanks & regards,


Add a group by clause at the very end of your query that includes all the columns in the select list as in

t1.rno, t1.amt,t2.rno,t2.amt,t3.rno,t3.amt

If you add additional columns, for example qno, you will need to group by those as well. And when you do that, you will get more than one row for a given combination of mo and amt.