How about
SELECT id,name
FROM trait
WHERE UPPER(name) IN ("RATIO")
문제
I need to select some rows in SQLite with case insensitive string. For example:
COLLATE NOCASE is working for "=", e.g.
SELECT id,name from trait WHERE name = "ratio" COLLATE NOCASE
But is not working for "in", e.g.
SELECT id,name from trait WHERE name in ("ratio") COLLATE NOCASE
I have to use "in" to select multiple values, e.g.
SELECT id,name from trait WHERE name in ("ratio", 'number') COLLATE NOCASE
How should I change my SQL script? Thanks for any suggestions.
해결책 2
How about
SELECT id,name
FROM trait
WHERE UPPER(name) IN ("RATIO")
다른 팁
The COLLATE NOCASE must appear directly after the expression it modifies.
When you write name in ("ratio", 'number') COLLATE NOCASE
, the collation is applied to the result of the comparison, which is just a number 0 or 1; a collation has no effect there.
The IN operator uses the collation of the expression on its left side, so this is where the collation must be applied:
... WHERE name COLLATE NOCASE IN ('ratio', 'number')