say I have 2 columns, ColumnA and ColumnB from a table named TableAB,
with sets of data like this
ColumnA ColumnB
====== ======
12345 67890
54321 67809
...... ........
67890 abcde
67809 fghkm
....... .....
I would like to do a LINQ queries to give me results such that when the ColumnB values appear in ColumnA, then ColumnB gives the new values such that
Results
======
12345abcde
54321fghkm
Is this possible?
Appreciate if there is some code queries.
thanks.
Loading

Jignesh TrivediRank #16 · 50.3K reputationPosted Jul 11, 2013, 6:57 PM EDT
hi,
If your class A like...
class TableA
{
public string ColumnA { get; set; }
public string ColumnB { get; set; }
}
try following code
List tableA = new List();
tableA.Add(new TableA { ColumnA = "12345", ColumnB = "67890" });
tableA.Add(new TableA { ColumnA = "54321", ColumnB = "67809" });
tableA.Add(new TableA { ColumnA = "67890", ColumnB = "abcde" });
tableA.Add(new TableA { ColumnA = "67809", ColumnB = "fghkm" });
var test = from a in tableA
join b in tableA on a.ColumnA equals b.ColumnB
select b.ColumnA + a.ColumnB;
foreach (var data in test)
{
Console.WriteLine(data);
}
hope this will help you.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 11:35 PM EDT
What is the relation between these two table? Please provide more details.
Regards,
Iftikar
TAN WhoAMIRank #5,790 · 286 reputationPosted Jul 10, 2013, 11:41 PM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 10, 2013, 11:53 PM EDT
Regards,
Iftikar
TAN WhoAMIRank #5,790 · 286 reputationPosted Jul 11, 2013, 12:01 AM EDT
thanks.
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 11, 2013, 1:24 AM EDT
Regards,
Iftikar
TAN WhoAMIRank #5,790 · 286 reputationPosted Jul 11, 2013, 4:22 AM EDT
Iftikar HussainRank #423 · 5.9K reputationPosted Jul 11, 2013, 6:14 AM EDT
Regards,
Iftikar
TAN WhoAMIRank #5,790 · 286 reputationPosted Jul 11, 2013, 6:46 PM EDT