Pavithra L

Pavithra L

  • NA
  • 336
  • 63.7k

How to avoid duplicate data during inner join

Dec 15 2015 4:41 AM
Hai ,
 
In my project am using C# windows application.   Here am I using Inner join for connect two datatable . I want to avoid the duplicate data during INNER JOIN from one table.
 
 
For an Example:
 Job NoOrder Qty Job No Knitt Qty Machine 
 11000 500 26 
 11000  1500 26
 
am using below code for this table:
 
Here I want to avoid the 2nd row entry of Job No and Order Qty  only . How can I do this. Please anybody help this. 
 
da = new SqlDataAdapter("select j.Group_Name,j.Due_Amt,p.Receipt_No,p.Customer_Name,p.Paid_Amount from Chit j INNER JOIN Chit_Collection p on j.Group_Name=p.Group_Name GROUP BY j.Group_Name", con1);
dt = new DataTable();
da.Fill(dt);
foreach (DataRow item in dt.Rows)
{
int n = dataGridView1.Rows.Add();
dataGridView1.Rows[n].Cells[0].Value = item["Group_Name"].ToString();
dataGridView1.Rows[n].Cells[1].Value = item["Due_Amt"].ToString();
dataGridView1.Rows[n].Cells[2].Value = item["Receipt_No"].ToString();
dataGridView1.Rows[n].Cells[3].Value = item["Customer_Name"].ToString();
dataGridView1.Rows[n].Cells[4].Value = item["Paid_Amount"].ToString();
}
 

Answers (11)