Click here to Skip to main content
15,891,184 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want fetch student data but one record fetching 3 times what was the problem?plz help me?
code:
C#
string stqr = "select c.Cand_Id,c.Candidature_Course,c.Candidature_Photo,c.Candidature_Stud_Nm,c.Candidature_Stud_Lnm,c.Candidature_Stud_Email,c.Candidature_Stud_Contact,c.Candidte_Int_job,c.Candidature_Stud_Resume from Candidature_Inst_Details c,Institute_Details i where c.User_Name = i.User_Name and c.Candidature_Course = '" + DropDownList1.SelectedValue + "' and c.Institute_branch = '" + DropDownList3.SelectedValue + "'and c.Candidte_Int_job='Job' and c.Cand_Id NOT IN(select Cand_Id from cand_post_details where Posting_Id='" + p1 + "')";
Posted
Updated 21-Aug-12 21:17pm
v3
Comments
janwel 22-Aug-12 2:41am    
where is your trial code? How can we help you if you dont post your code?
prashant patil 4987 22-Aug-12 2:44am    
please post your code also..and query also.may be problem becoz of distinct not using..
[no name] 22-Aug-12 2:46am    
please post ur code

Any one of your table have multiple records for the same course and for job. If all the columns of each row are same then use Distinct keyword.

Please provide the structure of the table with the records so we can help you better.

Thanks
Ashish
 
Share this answer
 
Use distinct.
C#
string stqr = "select distinct c.Cand_Id,c.Candidature_Course,c.Candidature_Photo,c.Candidature_Stud_Nm,c.Candidature_Stud_Lnm,c.Candidature_Stud_Email,c.Candidature_Stud_Contact,c.Candidte_Int_job,c.Candidature_Stud_Resume from Candidature_Inst_Details c,Institute_Details i where c.User_Name = i.User_Name and c.Candidature_Course = '" + DropDownList1.SelectedValue + "' and c.Institute_branch = '" + DropDownList3.SelectedValue + "'and c.Candidte_Int_job='Job' and c.Cand_Id NOT IN(select Cand_Id from cand_post_details where Posting_Id='" + p1 + "')";

I dont understand why you have table"Institute_Details" in from clause when you are not using it in select and where clause. if you not using at both places remove it and remove

C#
c.User_Name = i.User_Name
 
Share this answer
 
Hi friend,

Use "distinct " for filter duplicate value.
 
Share this answer
 
Hi ,

yes, use distinct for this.
 
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