Click to See Complete Forum and Search --> : [RESOLVED] MySQL search, unexpected results


blulagoon
06-30-2007, 02:24 PM
I am doing a very simple search:

SELECT productCode
FROM cubecart_inventory
where productCode like 'S_%'

I have designated product codes beginning with S_ for a specific purpose, but find that this query also retrieves product codes beginning with SA, SB etc etc.

Why is S_ not just retrieving the codes beginning S_, is there a way I can make this happen ?

Blu

mattyblah
07-01-2007, 06:24 PM
I think it might be thinking _ represents any character. Try \_ and let me know what happens.

blulagoon
07-02-2007, 07:08 AM
Thanks Mattyblah, that or something like that seems to be happening.

LIKE 'S\_%' achieves what I want.

Blu