使用DISTINCT无效 [英] Using DISTINCT doesn't make effect
本文介绍了使用DISTINCT无效的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
在以下位置查看我的上一个问题:
如何使用LINQ To从数据库中选择不同的数据SQL并具有良好的性能? [
See my previous question at:
How to select distinct data from DataBase with LINQ To SQL and have a good performance ?[^]
Hi all,
I need to remove frequent records from the result:
All result:
name department school
A---- D ---- S
A ---- C---- S
A---- D ---- S
B ---- D---- S
the result should be after using DISTINCT:
name department school
A---- D---- S
B---- D---- S
A---- C---- S
推荐答案
^ ]
它发现了,
这是您需要的查询:
Hi it-discovery,
This is the query you need :
var Query = (from query in dataClass.Student
select new
{
name = query.name,
department = query.department,
school = query.school
}).Distinct();
该查询将选择您需要的输出.
希望对您有所帮助,
谢谢
:)
This Query will select the output you need.
I hope this help,
Thank you,
:)
感谢Michael Waguih,
但是查询仍然不起作用:(
还有什么主意吗?
thanks Michael Waguih,
but the query still doesn''t work :(
any more idea?
这篇关于使用DISTINCT无效的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文