Hello, I need to ignore the rows that contain duplicate values in columns. I do not want to delete any rows in my table, only need to ignore them in my report. A1, Z1, TESTA A2, Z2, TESTB A3, Z3, TESTA A4, Z4, TESTF So I need to ignore rows 3, and keep rows 1,2,4 only. The output will become like this: A1, Z1, TESTA A2, Z2, TESTB A4, Z4, TESTF Any help is appreciated. Thanks.
I did something like this for your reference; ;with yourtable1(A, Z, T) as ( values ('A1', 'Z1', 'TESTA'), ('A2', 'Z2', 'TESTB'), ('A3', 'Z3', 'TESTA'), ('A4', 'Z4', 'TESTF') ), yourtable2 as ( SELECT A, Z,T, row_number() OVER (PARTITION BY T ORDER BY A) as RN FROM yourtable1 ) SELECT A,Z,T FROM yourtable2 WHERE RN = 1