PRABA
PRABA

Reputation: 460

Get unique record's in ms access query

I'm trying select the unique records from my table. My table contains nearly 20 columns and more than 500 000 records.

Sample data:

enter image description here

Desired Result:

enter image description here

I have used the following query, It returns the result which I need but taking lot of time to load the output.

SELECT [C1],[C2],[C3],[C4] 
FROM [dbo].[result]
WHERE [C1] = (
    SELECT MIN(C1) 
    FROM [dbo].[result] AS F 
    WHERE F.C2 = [dbo].[result].C2)

Is there any way to speed my query?

Upvotes: 0

Views: 43

Answers (1)

Gustav
Gustav

Reputation: 55806

Try with:

SELECT First([C1]) As Id, [C2], [C3], [C4] 
FROM [dbo].[result]
GROUP BY [C2], [C3], [C4] 

Upvotes: 1

Related Questions