I have two values in the database like
This is Name
this is a name
I am searching a phrase th
by SQL query
SELECT * FROM [TABLE_NAME] WHERE title LIKE '%th%'
then both filed is showing where I want only to show this is a name
part. How should I proceed. I have tried preg_merge and other parts but they didn't work. Is there any SQL Query which can distinguish capital and small letter
. Or any php method by which I can search exact term. My table format is UTF8. Not Latin General.
SELECT * FROM tableName WHERE title COLLATE latin1_general_cs LIKE '%th%'
Reference
The default character set and collation are latin1 and latin1_swedish_ci, so nonbinary string comparisons are case insensitive by default. This means that if you search with col_name LIKE 'a%', you get all column values that start with A or a. To make this search case sensitive, make sure that one of the operands has a case sensitive or binary collation. For example, if you are comparing a column and a string that both have the latin1 character set, you can use the COLLATE operator to cause either operand to have the latin1_general_cs or latin1_bin collation:
More importantly
If you want a column always to be treated in case-sensitive fashion, declare it with a case sensitive or binary collation. See Section 13.1.10, “CREATE TABLE Syntax”.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With