mysql 下locate和find_in_set的使用

LOCATE(substr,str)
select * from table where locate(UID,SALE_ID)>0 order by CREATE_TIME desc  limit 10

取出UID存在于SALE_ID内的数据,但有缺陷:str=123,456,789并且substr=12情况下,localte(substr,str)>0值为true。

此情况下推荐使用find_in_set(substr,str),用法类似。

你可能感兴趣的:(MySQL,mysql,oa系统,php)