那麼,對於內部聯接,你的SQL會大大隻
select a.Column1, a.Column2
from Table1 a
join Table2 b on b.Column1 = a.Column1
where a.Column3 = 'Something2' and b.ColumnB = 'Something1'
更具可讀性現在,你可以做,在僞LINQ
from a in Table1
join b in Table2 on a.Column1 equals b.Column1
where b.ColumnB == "Something1" and a.Column3 = ="Something2"
select new {
col1 = a.Column1,
col2 = a.Column2
};
或也
from a in Table1.Where(t => t.Column3 == "Something2"
join b in Table2.Where(t => t.ColumnB == "Something1")
on a.Column1 equals b.Column1
select new {
col1 = a.Column1,
col2 = a.Column2
};
woow!有效。我使用了「.Where(t => t.Column3 ==」Something2「」版本。非常感謝 –