0
我在我的應用程序中使用linq編寫我的子查詢。我在sql server中寫了我的sql子查詢。當我在SQL Server中執行此查詢的結果給予完善和SQL查詢會像如何在mvc5中使用linq編寫子查詢?
我的SQL Server:
select Row_Number() Over(OrderBy Mmname) as Sno,Mmname,Mmcardno,Mmdob,MmEmail,(Select SUM(MSSRNETAMT) from MSCAS where MSCAS.MSSFORMNO = MSMEM.MmCardno and MSCAS.MSSRBILLDT between '01/01/2016' and '30/12/2016') Billopen,(Select SUM(MSSRNETAMT) from MSCAS where MSCAS.MSSFORMNO = MSMEM.MmCardno and MSCAS.MSSRBILLDT between '01/01/2016' and '30/12/2016') BillForm,Mmredpv,Msdval,Mmcontact,Mmdate,Mmaddr,MmCuser,MmCuserdt,Mmusercd,
Mmuser,Mmuserdt,Cast(Mmcntrn as int) as Mmcntr from MSMEM inner join MSSCHEDET on MSMEM.Mschuid = MSSCHEDET.MSDID
我的LINQ查詢
Var query = (from Ms in db.msmems join Mss in db. Msschedet on Ms. Mechuid equals mss. MSDID select new
{
name = Ms. Mmname,
Billopen = (from mc in db. MSCAS where Ms. Mmcardno = mc. Mssformno) select mc.MSSRNETAMT);
}):
這只是我試過,但我我得到的錯誤是打開它是金額我得到錯誤
這是我的SQL查詢。我試圖在linq中轉換這個sql查詢。但是我失敗了很多次,我得到了一個錯誤。
你有什麼Linq代碼,你有什麼錯誤? – halfer