Page 1 of 1
SQLite Exact match
Posted: Tue Dec 08, 2020 8:22 am
by karweru
Hi all,
How can one get SQLite to return an exact match from a query,...the equivalent of ‘==‘ ?
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 10:59 am
by dragancesu
Yes or No, depending what you want
Query result can be number, character or array, big array
If your query result is number or character answer is Yes
otherwise is No
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 12:04 pm
by karweru
I need for strings,
Code: Select all
select account_code from payr where payr_code=‘c’;
This query also returns instances where payr_code is capital ‘C’. I need it to only return small ‘c’ instances.
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 12:42 pm
by dragancesu
https://sqlite.org/lang_corefunc.html
see function lower
select lower(account_code) from payr where payr_code=‘c’;
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 4:54 pm
by karweru
Thank you dragancesu,
Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 5:39 pm
by dragancesu
I don't use SQLite but you can find resolve your problem
https://stackoverflow.com/questions/973 ... -comparing
SELECT * FROM ... WHERE name = 'someone' COLLATE NOCASE
Re: SQLite Exact match
Posted: Tue Dec 08, 2020 10:36 pm
by jairpinho
karweru wrote: ↑Tue Dec 08, 2020 4:54 pm
Thank you dragancesu,
Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
Hello,
select account_code from payr where payr_code like ‘c’; or COLLATE NOCASE
Re: SQLite Exact match
Posted: Thu Dec 10, 2020 9:41 pm
by susviela
karweru wrote: ↑Tue Dec 08, 2020 4:54 pm
Thank you dragancesu,
Not exactly what I require. The problem is after WHERE. It would appear the EQUAL operator (=) is case insensitive,...can't find a way to force it to recognize case such that 'C' is not equal to 'c'
LIKE is no case sensitive
select * from client where name LIKE 'dan'
without the % is ==
the problem is the speed of LIKE
Re: SQLite Exact match
Posted: Fri Dec 11, 2020 4:10 am
by jayadevu
Hi,
I am sure you must have searched in Google for an option. When I searched use of "Glob" function has come up.
Please see discussion here:
https://stackoverflow.com/questions/223 ... -sensitive
Hope that helps.
Warm regards,
Jayadev
Re: SQLite Exact match
Posted: Fri Dec 11, 2020 7:27 am
by karweru
Thank you all,
Thank you Jayadev, GLOB works perfectly. Stuff like this makes one really appreciate harbour
