开发者

How can i write a inner join query using linq

I have write a inner join query. In SQL Server it is working fine, but I want to write this query usin开发者_如何学Pythong Linq-to-SQL. Can anybody help me please?

Here is my query in SQL Server:

select db.Firstname, db.lastname, lo.BiPayAmt, lo.Loan_ID, sc.Pmt_Id,
    sc.Terms, sc.pmt_dates, sc.LoanId
from dbo.Clients db
inner join dbo.Loans lo on db.Client_ID = lo.Client_ID
inner join dbo.SchedulePayments sc on lo.Loan_ID = sc.LoanId


Roughly this:

from db in dbo.Clients
join lo in dbo.Loans on db.Client_ID equals lo.Client_ID
join sc in dbo.SchedulePayments on lo.Loan_ID equals sc.LoanId
select new
{
    db.Firstname,
    db.lastname,
    lo.BiPayAmt,
    lo.Loan_ID,
    sc.Pmt_Id,
    sc.Terms,
    sc.pmt_dates,
    sc.LoanId
}
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜