문제

I have an Open Office database. I'd like to use the LIKE operator with "%" marks between two columns in the same table:

SELECT * FROM "table1" WHERE UPPER ( "table1"."a" ) LIKE UPPER ('%' + "table1"."b" + '%' )

But it doesn't work, although

SELECT * FROM "table1" WHERE UPPER ( "table1"."a" ) LIKE UPPER ("table1"."b")

works. What's wrong in my syntax?

도움이 되었습니까?

해결책

Missing a + on the front after the % and before table.

SELECT [insert your fields here] FROM "table1" WHERE UPPER ( "table1"."a" ) LIKE UPPER ('%' + "table1"."b" + '%' )

Updated

SELECT [insert your fields here] FROM "table1" WHERE UPPER ( "table1"."a" ) LIKE '%' + UPPER("table1"."b") + '%' 

I'm assuming A and B are both of the same data type.

I'm assuming + is an string concat in openoffice. other possible values are || or &

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top