首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > .NET >

为何查询出来的数据比数据库还多

2013-07-01 
为什么查询出来的数据比数据库还多aList aObj.GetListInfo(condition, )uList uObj.GetListInfo(

为什么查询出来的数据比数据库还多

    aList = aObj.GetListInfo(condition, "");
            uList = uObj.GetListInfo("", "");
            mList = mObj.GetListInfo("", "");
            var result = from p in aList
                     
                         join q in uList on p.i_client_id equals q.UserId
                         join m in mList on q.UserId equals m.BeatedUserID                       
                         select new
                         {
                             p.i_datetime,
                             p.i_client_id,
                             money = p.i_op_id == "客户入金" ? p.e_post_bala.ToString() : "",
                             money2 = p.i_op_id == "客户入金" ? p.e_post_bala.ToString() : "",
                             money3 = p.i_op_id == "申请出金" ? p.e_post_bala.ToString() : "",
                             money4 = p.i_op_id == "客户出金" ? p.e_post_bala.ToString() : "",


                             p.e_post_bala,
                             p.e_current_bala,
                             p.i_flag,
                             m.Bail,
                             q.Fee
                         };

            anp.RecordCount = result.Count();
            this.GridView1.DataSource = result.Skip((anp.CurrentPageIndex - 1) * anp.PageSize).Take(anp.PageSize);

            this.GridView1.DataBind();

好奇怪 ,数据库里面没有那张表的数据库超过1W条,为什么上面这样查出来有70多W条数据,,当然有很多是重复的,,。。 aList 的count值为1000多,uList 是400多,mList 是200多,。。  求解 ,, 在线等,, 急急 LINQ 数据查询
[解决办法]
从代码来看是inner join

从你描述的结果来看,又是cross join

不如直接单步调试,查看LINQ语句生成的SQL查询语句是什么

热点排行