gpt4 book ai didi

c# - 从 DataGrid 中删除重复行

转载 作者:太空狗 更新时间:2023-10-30 01:01:46 25 4
gpt4 key购买 nike

我正在使用 ASP.NET DataGrid 类。 asp:DataGrid我想根据以下条件删除某些行。

例如:

Complaint-Number        Attempts   Time
6000000939 1 11:02:00
6000000939 2 11:04:00
6000000939 3 11:09:00

我只想保留那些尝试次数最多的投诉。

Complaint-Number        Attempts   Time
6000000939 3 11:09:00

我试过这个例子,但还是不行 Eliminate Duplicate

注意:请注意,我正在使用 asp:DataGrid 类。

请找到我的报告截图供您引用。

enter image description here

最佳答案

在你的 Select 语句中尝试这样的事情。:

SELECT *
FROM yourTable
WHERE (Attempts IN
(SELECT MAX(Attempts) AS Expr1
FROM yourTable AS yourTable_1))

它称为子查询,您可以在这里阅读更多信息:Subquery Fundamentals .

关于c# - 从 DataGrid 中删除重复行,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/36862181/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com