与其他记录不同的记录 [英] distinct records with others records

查看:82
本文介绍了与其他记录不同的记录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨团队,

很高兴见到你们。

我的数据如下:

Sr.no名字姓氏

1苛刻的raut

2严酷的raut

3 john cena



我得到了Harsh raut的独特记录但是我不能得到john cena。我也想要那些记录。好心的建议

我写了一个LINQ表达式,其中我得到了重复的独特记录但除了重复记录我我也想要其他人。我需要在LINQ语句中做些什么更改。

Hi Team,
nice to see you all .
I have a data as follows:
Sr.no Name Surname
1 Harsh raut
2 Harsh raut
3 john cena

I am getting the distinct records that is Harsh raut but i cant get john cena .i want that records too.Kindly advice
I wrote a LINQ expression in which i am getting the distinct record for duplicate but except duplicates records i want others too.What changes i need to do in my LINQ Statement.

private IEntityCollectionBase RemoveZteBbhDuplicats(IEntityCollectionBase zteBbhRecords, IFileLog fileLog) {




string[] distinctRecord = zteBbhRecords.Cast<IZteBbh>().Select(zteBbh => (zteBbh.CombinedMaster as ICombinedMaster).ToString()).GroupBy(items => items).Where(items => items.Count() > 1).Select(items => items.Key).Distinct().ToArray();}





谢谢

Harshal



Thanks
Harshal

推荐答案

删除where条件



remove the where condition

string[] distinctRecord = zteBbhRecords.Cast<iztebbh>().Select(zteBbh => (zteBbh.CombinedMaster as ICombinedMaster).ToString()).GroupBy(items => items).Select(items => items.Key).Distinct().ToArray();


var distinctData = (from g in context.TableName



选择g).ToList()。Distinct();


select g).ToList().Distinct();


参见here [ ^ ]


这篇关于与其他记录不同的记录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆