SQL select single column

I have a query that returns the following data

enter image description here

as you can see in the image, the colored groups are similar to the "A" columns. I want to take the first occurrence of these lines relative to the "A" column and discard the rest.

so I can finish this result.

enter image description here

any solutions?

Thank:)

Update:

these are the original query results enter image description here

+5
source share
1 answer

I would do it like this:

WITH T(A, B, C, D, RowNum) AS 
(
    SELECT A, B, C, D, ROW_NUMBER() OVER (PARTITION BY A ORDER BY A)
    FROM MyTable
)
SELECT * FROM T
WHERE 
    RowNum = 1
+6
source

All Articles