Remove duplicate rows from DataGrid

I am using the ASP.NET class DataGrid. asp: DataGrid I want to delete specific rows based on the following condition.

Example:

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

I want to keep only those complaints that have the highest Attempts.

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

I tried this example but still no luck Eliminate Duplicate

NOTE: Please note that I am using the asp: DataGrid class .

Please find a screenshot of my report for reference.

enter image description here

+4
source share
2 answers

In your expression, Selecttry something like this:

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

Subquery, : .

+4

SELECT DISTINCT FROM yourtable ORDER BY ASC

ORDER BY Attempts DESC .

+1

All Articles