0

以下の単純な SQL クエリを LINQ に変更したいのですが、どうすれば変更できますか?

select * from table1 where isPaid = 'true' and  Id in (select Id from table2 where EmployeeId = 12) 

これに似ていますか?

from pa in db.PaymentAdvices
where pa.IsPaid == true
orderby pa.PaidDate descending
select pa;
4

2 に答える 2

0

フィールドisPaidのデータ型がBooleanの場合:

from t1 in table1
join t2 in table2 on t1.Id equals t2.Id
where t2.EmployeeId = 12 and t1.isPaid == true
select t1

フィールドisPaidのデータ型がStringの場合:

from t1 in table1
join t2 in table2 on t1.Id equals t2.Id
where t2.EmployeeId = 12 and t1.isPaid.Equals("true")
select t1
于 2013-04-22T08:10:38.017 に答える
0

ここで linq を sql にコード化します。

from t1 in table1
join t2 in table2 on t1.Id equals t2.Id
where t2.EmployeeId = 12
select t1

役に立つことを願っています!

于 2013-04-22T07:26:44.703 に答える