Hailwood
Hailwood

Reputation: 92601

mysql search for 'No.' not 'no.' or 'no';

Is there any way that i can cause mysql to be case sensitive whe searching using where x like '%No.%';

Upvotes: 3

Views: 140

Answers (3)

dcp
dcp

Reputation: 55449

You could change the column type:

create table my_table (case_sensitive_column VARCHAR(10)) CHARACTER SET latin1 COLLATE latin1_bin;

EDIT Actually, jwsample's answer is better because you don't have to modify the table.

Upvotes: 3

jwsample
jwsample

Reputation: 2411

Try this:

SELECT * FROM <table> WHERE <column> COLLATE latin1_bin LIKE '%No.%'

Upvotes: 4

Related Questions