Skip to content
Advertisement

Count No of column value matched and not matched in SQL

I have a dataset where in I am trying to find the count of values matched in a column and count of values not matched. Also I am trying to find out same and different values . Eg.

ID is always same. Column F1 and F2 will change values . I need to find out for an ID how many Column F3 values are same and different in each set of F1 and F2. Also what are those values. Expected output is

sample code I tried is :

After that I left joined with same table to get different values and count but not progressing well. Any help is highly appreciated.

Regards, A

Advertisement

Answer

A shorter version to your requirements:

gives:

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