Page 1 of 1

What does '%search%' do?

Posted: Mon Nov 28, 2005 9:24 am
by mhouldridge
Hi,

Just wondering about one of my queries....

I use '% %' for searching - Why do we use % here?


thanks

Posted: Mon Nov 28, 2005 9:32 am
by infolock
%'s are used namely in LIKE statements. the %something% means that you are searching for any string that mathes what is in between the %'s.

ie, if you were searching for anything that had hte word ID in it, like state_id, man_id, or cat_id_num, you could do :

Code: Select all

LIKE %id%
or, you could just use %something

Code: Select all

LIKE %id
which would return ONLY the ones that match having the word "id" at the end of it. the above example would only return, state_id and man_id

last, you could throw it at the end to match anything after the string

Code: Select all

LIKE man%
which would return only man_id

Posted: Mon Nov 28, 2005 9:36 am
by Jenk
% is the marker for wildcard, much like searching on Windows or Unix based OS's with *.

Posted: Mon Nov 28, 2005 9:38 am
by mhouldridge
Ahhh!

Very interesting, thanks for that!

Much appreciated!