cancel
Showing results for 
Search instead for 
Did you mean: 

Comparing 2 columns in a table using Fuzzy Search

former_member182302
Active Contributor
0 Kudos

Hello SCN,

I have create a table as mentioned below with VARCHAR columns:


create column table fuzzytest ( a int,b varchar(10),c varchar(10))

insert into fuzzytest values ( 1,'ABCD','CD')

insert into fuzzytest values ( 2,'ABCD','AB')

insert into fuzzytest values ( 3,'ABCD','BC')

insert into fuzzytest values ( 4,'ABCD','AD')

We can fire queries like below to search for a specific value , example : 'CD'

But can we compare 2 columns?  I wanted to display the records when Column C is a substring of Column B , example as shown below:


1,ABCD,CD

2,ABCD,AB,

3,ABCD,BC

Request your help to let me know If I am missing something here? or is this is jst not supported?

Accepted Solutions (1)

Accepted Solutions (1)

former_member182114
Active Contributor
0 Kudos

Hi Krishna,

This seems to be not supported, tested on SP10 and received error below:

Could not execute 'select t.*,score() from fuzzytest t where ...' in 458 ms 776 µs .

SAP DBTech JDBC: [8] (at 55): invalid argument: The second argument cannot include any column: line 3 col 20 (at pos 55)

Anyhow, it also doesn't make sense as the score will be totally corrupted as the key factor is changing row by row.

If your quest is find it substring maybe this is enough:

where t.b like '%' ||t.c || '%'

Regards, Fernando Da Rós

former_member182302
Active Contributor
0 Kudos

Hi Fernando,

Thanks for your reply. I understand we can do with the wild card search but as it hits ROW engine , so was I checking around Fuzzy search options and wanted to know whether it supports or not.

Thanks once again for confirming.

Regards,

Krishna Tangudu

Answers (0)