0

I am trying to search for data which are similar, but not exactly same, means that the data is not total duplicate.

I need to find the data for the column value PROJECTNAME,from the record PSPROJECTITEM, which contains two fields like this, AZ_HCM_901 and AZ_HCM_901_BKP.

So the field AZ_HCM_901 and AZ_HCM_901_BKP are similar, even the column value of these two fields are same, but they are not exact duplicate, i need a query to retrieve the values which are similar, and are separated by _BKP in the table along with the orignial.

!Table structure 1

And this is how the value looks like:

**AZ_HCM_901_BKP 0 1 ADDRESSES 0 0 0 0 4 4 3 1 1

AZ_HCM_901 0 1 ADDRESSES 0 0 0 0 4 4 3 1 0**

So we can see that the values are similar except for the column PROJECTNAME.

Also, AZ_HCM_901 is an example here, table contains the PROJECTNAME like this. I want to retrieve the values which are exactly like this, one original and one separated by _BKP

I want the data be in separate rows.

Thanks for the help.

vamosrafa
  • 685
  • 5
  • 11
  • 35

1 Answers1

0
SELECT proj_1.*, proj_2.*
FROM PSPROJECTITEM proj_1
     INNER JOIN PSPROJECTITEM proj_2 ON concat(proj_1.projectname, '_BKP') = proj_2.projectname; 
TrongBui
  • 31
  • 5