SQL to find out Match in a group of the same table

Database
Fan

SQL to find out Match in a group of the same table

Hi All

I have a requirement to differentiate between exact match and partial match of id numbers based on id_type  in  a group of the same table . My table looks like

Grp_id    Pid                   Id_number        Id_type

1           123                 A1234                IDN

1           123                 B1234                IDO

1            456               A1234                 IDN

2            789                 xyz1                  IDN

2            789                tuv1                   IDO

2            678                tuv1                   IDN

2           678                 xyz1                   IDO

3         987                 ghi234                IDO

3         987                  jkl1234              IDN

3         367                 ghi1234              IDO

In the above 3 scenarios group 1 and 3 is partial match and group2 is an exact match , if id numbers match exactly based on idtype in a group that is an exact match else a partial match. We can have any number of idnumbers in a group i.e  the relation between PID and ID_Number is many to many . I tried recursive sql but it doesnt work for me .  

Can some one please help me with the SQL or give some pointers

2 REPLIES
Fan

Re: SQL to find out Match in a group of the same table

Can any one help me plz?

Enthusiast

Re: SQL to find out Match in a group of the same table

Self join?