欢迎您访问程序员文章站本站旨在为大家提供分享程序员计算机编程知识!
您现在的位置是: 首页  >  IT编程

C# ling to sql 左表连接

程序员文章站 2022-06-19 19:21:43
var begin_daily = from a in _postgreDbContext.tab1 join b in _postgreDbContext.tab2 on a.id equals b.merchant_id into a_left ... ......
  var begin_daily = from a in _postgredbcontext.tab1
                                      join b in _postgredbcontext.tab2 on a.id equals b.merchant_id into a_left
                                      from  left_a in a_left.defaultifempty()
                                      where left_a.date.tostring("yyyy-mm-dd") == begin_date
                                      select new {
                                        left_a.id,
                                        left_a.balance,
                                        left_a.service_balance,
                                        left_a.paid_money
                                      };