Mega Code Archive

 
Categories / MySQL Tutorial / String Functions
 

LOCATE(substr,str)

Returns 0 if substr is not in str. mysql> mysql> SELECT LOCATE('ABC', 'ABCABC'); +-------------------------+ | LOCATE('ABC', 'ABCABC') | +-------------------------+ |                       1 | +-------------------------+ 1 row in set (0.00 sec) mysql> mysql> SELECT LOCATE('AA', 'AABBCCDD'); +--------------------------+ | LOCATE('AA', 'AABBCCDD') | +--------------------------+ |                        1 | +--------------------------+ 1 row in set (0.00 sec)