Click here to Skip to main content
15,868,164 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Table 1

COLUMN A   COLUMN B COLUMN C

123          4        XXX

124          2        XYZ

125          4        LSK

142          4        TSY

156          2        ASA


TABLE 2

COLUMNA   COLUMNC   COLUMNF    COLUMNZ

123        XXX        0          QWRT

124        XYZ        0          TYET

125        LSK        0          REXG

142        TSY        0          LKOY

156        ASA        0          MJKL


What I have tried:

I want to table 1 => query1=> select column a where columnb=4

AND

I want to table 2 => select a where columnf=0 and contains (query1) // this query I want to lambda expression.(
I want to table 2 => select a where columnf=0 and contains (query1))
Posted
Updated 11-Jan-20 12:12pm
v2

1 solution

This should've done the trick:
C#
var result = table2.Where(second=>second.columnf == 0 && 
           table1.Any(first=>first.columnb == 4 && first.columna == second.columna))
    .ToList();
 
Share this answer
 
Comments
Member 14169626 12-Jan-20 14:51pm    
hello actually the process is correct, but I want to take 4 according to the value of the column c s to add the column c s.
So if the value of xxx is 4 in the second table xxx is 4 and I want to find the value of xxx in the second query.
Maciej Los 13-Jan-20 2:38am    
So, change the code accordingly:
&& first.columnc == second.columnc

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