zoukankan      html  css  js  c++  java
  • linq 多表分组左连接查询查询统计

    return (from merchantsInfo in base.GetIQueryable(x => x.IsLogicDelete == false && x.FID != fid)
                        join userAccount in UserAccountDal.GetIQueryable(x => x.PrivilegeLevel > 0)
                        on merchantsInfo.UserAccountID equals userAccount.FID
                        join merchantsfrom in MerchantsInfoFormDAL.GetIQueryable(x => !x.IsLogicDelete)
                        on merchantsInfo.FID equals merchantsfrom.MerchantsInfoID into data
                        from merchants in data.DefaultIfEmpty()
                        group new { merchants.MerchantsInfoID } by new
                        {
                            merchantsInfo.FID,
                            merchantsInfo.Name,
                            merchantsInfo.BrandLabel,
                            merchantsInfo.MainPicture,
                            merchantsInfo.MerchantsAmountMax,
                            merchantsInfo.MerchantsAmountMin,
                            merchantsInfo.MerchantsAmountType,
                            merchantsInfo.ProjectName,
                            merchantsInfo.BelongIndustry,
                            merchantsInfo.BelongIndustryChild,
                            merchantsInfo.MerchantsArea,
                            merchantsInfo.MerchantsAreaCity,
                            merchantsInfo.MerchantsAreaCitySubset,
                            merchants.MerchantsInfoID
                        } into g
                        select new MerchantsModel
                        {
                            FID = g.Key.FID,
                            Name = g.Key.Name,
                            BrandLabel = g.Key.BrandLabel,
                            MainPicture = g.Key.MainPicture,
                            MerchantsAmountMax = g.Key.MerchantsAmountMax,
                            MerchantsAmountMin = g.Key.MerchantsAmountMin,
                            MerchantsAmountType = g.Key.MerchantsAmountType,
                            ProjectName = g.Key.ProjectName,
                            BelongIndustry = g.Key.BelongIndustry,
                            BelongIndustryChild = g.Key.BelongIndustryChild,
                            MerchantsArea = g.Key.MerchantsArea,
                            MerchantsAreaCity = g.Key.MerchantsAreaCity,
                            MerchantsAreaCitySubset = g.Key.MerchantsAreaCitySubset,
                            ApplyNum = g.Key.MerchantsInfoID == null ? 0 : g.Count()
                        }).Take(row).ToList();
  • 相关阅读:
    尝试一个“建立知识”的过程
    webscheduler 开源定时服务和延迟服务
    两款自定义表单设计器
    IIS应用池保持激活工具开发
    写文章 使用conda管理python环境
    conda 虚拟环境
    Java设计模式
    转:数据标准化/归一化normalization
    转:理解矩阵
    转:为何梯度反方向是函数值下降最快的方向
  • 原文地址:https://www.cnblogs.com/chenxi001/p/12551134.html
Copyright © 2011-2022 走看看