Hello,
I’ve got such a KeyWord table (MS SQL):
- KeyGuid Qualifier PrimitiveKey
- DA7E4E27-FDE5-4D43-A365-8A789164A816 tit kirkäna
- EED58875-FE41-4A18-A93C-A44AA62CEEEE htit kirkänbh
- A0EB795E-EE23-4990-BAB9-897C93C70CE3 htit kirkänah
- F7F4632B-AC82-4DEB-B966-BBA8EF4D2C9E tit kirkänb
- C0EB795E-EE23-4990-BAB9-897C93C70CE3 nam kirkänas
- E2F4632B-AC82-4DEB-B966-BBA8EF4D2C9E nam kirkänbs
- A222795E-EE23-4990-BAB9-897C93C70CE3 tit kirkacb
- B333632B-AC82-4DEB-B966-BBA8EF4D2C9E tit kirkaca
- 1222795E-EE23-4990-BAB9-897C93C70C81 htit kirkacbh
- E533632B-AC82-4DEB-B966-BBA8EF4D2C82 htit kirkacah
This simplest query properly returns all relevant records:
select * from KeyWord where PrimitiveKey like 'kirkän%'
- DA7E4E27-FDE5-4D43-A365-8A789164A816 tit kirkäna
- EED58875-FE41-4A18-A93C-A44AA62CEEEE htit kirkänbh
- A0EB795E-EE23-4990-BAB9-897C93C70CE3 htit kirkänah
- F7F4632B-AC82-4DEB-B966-BBA8EF4D2C9E tit kirkänb
- C0EB795E-EE23-4990-BAB9-897C93C70CE3 nam kirkänas
- E2F4632B-AC82-4DEB-B966-BBA8EF4D2C9E nam kirkänbs
I use such a query to limit the resutls to match specific qualifiers:
select * from KeyWord where Qualifier IN ('tit', 'htit') and PrimitiveKey Like 'kirkac%'
which works perfectly:
- A222795E-EE23-4990-BAB9-897C93C70CE3 tit kirkacb
- B333632B-AC82-4DEB-B966-BBA8EF4D2C9E tit kirkaca
- 1222795E-EE23-4990-BAB9-897C93C70C81 htit kirkacbh
- E533632B-AC82-4DEB-B966-BBA8EF4D2C82 htit kirkacah
However when the phrase contains a special character like ä it does not return results:
select * from KeyWord where Qualifier IN ('tit', 'htit') and PrimitiveKey Like 'kirkän%'
nor does it with the qualifiers limited like this:
select * from KeyWord where (Qualifier = 'tit' OR Qualifier = 'htit') and PrimitiveKey Like 'kirkän%'
However it does work like this:
select * from KeyWord where (Qualifier like 'tit' OR Qualifier like 'htit') PrimitiveKey Like 'kirkän%'
- DA7E4E27-FDE5-4D43-A365-8A789164A816 tit kirkäna
- EED58875-FE41-4A18-A93C-A44AA62CEEEE htit kirkänbh
- A0EB795E-EE23-4990-BAB9-897C93C70CE3 htit kirkänah
- F7F4632B-AC82-4DEB-B966-BBA8EF4D2C9E tit kirkänb
What is wrong with the IN approach?