Skip to content
Advertisement

Match duplicate value from the second column based on duplicate value from first colum

I have table like this

I have two condition for this table which is :

  1. Val column must be duplicate value AND,
  2. Val2 column must be duplicate

so my goal is return data if the two condition meet. If the column val had duplicate value and column val2 had duplicate value and each column on his own row.

my query looks like this

the result was like this

As you can see the column did not match with each other

I expect the result data was like this

here is my fiddle

Advertisement

Answer

You need a having and join. Here is the demo.

output:

User contributions licensed under: CC BY-SA
1 People found this is helpful
Advertisement