Debt Consolidation - Debt Consolidation - Find jobs - Debt Consolidation - Debt Consolidation

PDA

View Full Version : Like clause in sql statement


Cinta April
Apr 26th 2008, 10:40 am
Hi I am trying to match a field that contains any alphabet but it does not return any rows?

SELECT ..Name LIKE '%[a-z]%'

why doesn't this return any rows?

helpplease
Apr 26th 2008, 12:25 pm
your using regex in a like statement to you use regexp you need to "WHERE Name REGEXP '[REGEX-HERE]'"

+ check mysql manual for regexp

liek should be WHERE Name LIKE '%henr%'
returns henry, henroid, henrica etc

andrew1056
Apr 26th 2008, 3:08 pm
I think your regex should look like this (not sure... I'd have to test it myself. WHERE name LIKE '[A-Za-z]'; Google mysql LIKE statement. It'll tell you the correct way to match letters.

Freewebspace
Apr 26th 2008, 9:09 pm
Does anybody know where I can find mysql manual?

Cinta April
Apr 27th 2008, 2:24 am
ok it turns out that like has no ability to match any alphabet in mysql. i guess i'll have to use regexp