Forum Moderators: coopster
Example
*******
ROBERT
ROBERTA
AROBERT
select name from dbase where name = 'ROBERT' will return 1 result (ROBERT)
select name from dbase where name like 'ROBERT' will return 1 result (ROBERT)
select name from dbase where name like '%ROBERT' will return 1 result (AROBERT)
select name from dbase where name like 'ROBERT%' will return 1 result (ROBERTA)
select name from dbase where name like '%ROBERT%' will return 3 result (AROBERT, ROBERTA, ROBERT)
Maybe a silly question about MySQL
Nothing silly about the question at all. Thanks tomda for the usage description. I know this is silly but, I guess the first time I saw an example of LIKE the percent sign was used on both ends. So I always use it that way and never considered the possibility of left or right matching. sigh....
select name from dbase where name like '%ROBERT' will return 2 results (ROBERT, AROBERT)
select name from dbase where name like 'ROBERT%' will return 2 results (ROBERT, ROBERTA)