I am having data as shown below
Id1 Id2 Id3 Name Date
1 2 3A testA 4/1/2024
1 2 3A testB 4/1/2024
1 2 3A testC 4/1/2024
2 2 3A testA 4/1/2024
2 2 3A testB 4/2/2024
2 2 3A testC 4/3/2024
3 4 4A testD 4/6/2024
3 4 4A testE 4/7/2024
4 4 4A testD 4/6/2024
4 4 4A testE 4/7/2024
6 5 6A testF 4/6/2024
6 5 6A testG 4/7/2024
7 5 6A testF 4/6/2024
I tried with below query and its not giving me result as expected
select * ,ROW_NUMBER() over (PARTITION BY Id1,Id2,Id3,Name,Date order by Id1) rn
from TableA where rn=2
I am expecting the result to be PARTITION should be identical and if everything matches and count of records in each partition matches like sample below
Id1 Id2 Id3 Name Date
3 4 4A testD 4/6/2024
3 4 4A testE 4/7/2024
4 4 4A testD 4/6/2024
4 4 4A testE 4/7/2024
Please let me know how can we achieve this using any other functions