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 No | Order Qty | Job No | Knitt Qty | Machine |
| 1 | 1000 | 1 | 500 | 26 |
| 1 | 1000 | 1 | 500 | 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();
}


Manas MohapatraRank #182 · 13.2K reputationPosted Dec 15, 2015, 12:02 AM EST
Pavithra LRank #4,546 · 338 reputationPosted Dec 15, 2015, 12:06 AM EST
Manas MohapatraRank #182 · 13.2K reputationPosted Dec 15, 2015, 12:26 AM EST
Pavithra LRank #4,546 · 338 reputationPosted Dec 15, 2015, 12:36 AM EST
Pavithra LRank #4,546 · 338 reputationPosted Dec 15, 2015, 12:56 AM EST
Raja TRank #685 · 3.5K reputationPosted Dec 15, 2015, 2:12 AM EST
Pavithra LRank #4,546 · 338 reputationPosted Dec 15, 2015, 2:24 AM EST
Raja TRank #685 · 3.5K reputationPosted Dec 15, 2015, 3:01 AM EST
Pavithra LRank #4,546 · 338 reputationPosted Dec 15, 2015, 3:13 AM EST
Ranjit PowarRank #553 · 4.4K reputationPosted Dec 15, 2015, 9:32 PM EST
Gomathi Raguprasad4 reputationPosted Dec 16, 2015, 1:20 AM EST
Hi,
I think, Its not possible to make group name and Due values to null or delete with your requirement.Because the customer and group name mapping will get affect.
select distinct j.GroupName,j.Due from Chit j INNER JOIN Chit_Collection p on j.GroupName=p.GroupName
SELECT ReceiptNo,Customer,Paid FROM Chit j INNER JOIN Chit_Collection p on j.GroupName=p.GroupName