sql:

select a.*,b.IsPayment from Appointment a left join OrderPayment b on a.yyid=b.yyid where b.IsPayment IS NULL or  b.IsPayment =0

linq:(linq中无left join)

var temp = db.Appointment
                    .Where(t => t.OrderID == orderid && t.IsDelete == 0)
                    .Where(t => !db.OrderPayment.Any(p =>  p.IsPayment != PaymentTypeEnum.NoPayment && p.YYID == t.YYID))
                    ;

 

posted on 2022-05-27 18:08  叶子牛牛  阅读(107)  评论(0)    收藏  举报