SQL ת LINQ, ¶àleft join ,ÔÚÏߵȽáÌù
SQL code:
SELECT Patients.*, CurrentSurgeries.*,Fac_PreopChecklists.*
from
(Patients left join Pt_CurrentSurgeries on Patients.PatientID = Pt_CurrentSurgeries.PatientID)
left join Fac_PreopChecklists on Fac_PreopChecklists.Pt_CurrentSurgeryID=Pt_CurrentSurgeries.Pt_CurrentSurgeryID
left join CurrentSurgeries on Pt_CurrentSurgeries.CurrentSurgeryID = CurrentSurgeries.CurrentSurgeryID, Pt_Forms, Forms
WHERE (Pt_CurrentSurgeries.StatusID>0 OR Pt_CurrentSurgeries.StatusID is null)
AND (CurrentSurgeries.SurgeryDate>=GETDATE() or CurrentSurgeries.SurgeryDate is null)
AND Patients.PatientID = Pt_Forms.PtID
AND Pt_Forms.FormID = Forms.FormID
AND Forms.FacilityID=12
AND (Patients.FirstName like '%sdf%' OR Patients.LastName like '%sdf%')
¸Õ·¢ÏÖLinq to entities ²»ÄÜDefaultIfEmpty()
Ïà¹ØÎÊ´ð£º
ÎÒÓÐÒ»¸ö±í£¬½á¹¹ÊÇÕâÑù¡£
ת³ö µ¥Î» תÈ뵥λ ±ÊÊý ½ð¶î
date(Ö÷) outid(Ö÷) inid(Ö÷) num amt
2009 1 2 1 500 Ϊ 1 µ¥Î» ÔÚ2009Ä ......
protected void btnLogin_Click(object sender, EventArgs e)
{
SqlConnection conn = new SqlConnection("Server = (local);user id = sa;pwd = 1;database = Login");
&nb ......
select count(1) from FX_RETURNBOOKCHECKLIST fxreturnbo0_ where fxreturnbo0_.BOOKID='164 ' AND fxreturnbo0_.RETURNID='00025.S0000001'
ÉÏÃæÒ»¸ö¼òµ¥µÄSQL,Ö´ÐÐʱ¼ä2.6à ......
tab1 ×Ö¶Î:billdate,goodsid,incount,inmoney,outcount,outmoney,endprice,endcount,endamt
tab2 ×Ö¶Î:goodsid,goodskind£¨ÉÌÆ·ÀàÐÍ£©
tab3 ×Ö¶Î:goodskind£¨ÉÌÆ·ÀàÐÍ£©,kindname
½á¹û£º
µÃµ½ÉÌÆ·ÀàÐÍÔÚÒ»¶Îʱ¼ä ......