tags:

views:

20

answers:

0

I'm experiencing a very strange issue with string equality in SQLite3. I have a table with a text column named type.

If I run select distinct type, 2 from mytable order by type (the 2 is there to get the pipe separator), I get:

...
Tops|2
...
Tops|2

i.e., the same column appears twice. This is causing me problems because queries with the where clause WHERE type ='Tops' only return rows that match the first 'instance' of tops.

Anyone know what's going on here? Is it a string encoding issue?

Curiously, running select distinct lower(type) from clothing_category where type ='tops' returns only one result. Somehow, the lower function resolves the issue.