1、CONCAT and COALESCE
CONCAT(field1, field2, ...): 如果其中一个field是null,则返回null。returns NULL if any argument is NULLCOALESCE(value,...):Returns the first non-NULL value in the list, or NULL if there are no non-NULL values.
select distinct `doc`.* from `wk_project` as `pro` left join `wk_document` as `doc` on `pro`.`project_id` = `doc`.`project_id` and `pro`.`project_id` = '1' where CONCAT(doc.doc_name, COALESCE(doc.doc_content,'')) LIKE '%员工%' order by `doc`.`doc_sort` asc, `doc`.`doc_id` asc
2、length and char_length
select length('日本語'), char_length('日本語'); // 9 3
3、FIND_IN_SET
字段poster_category_id是存储类似于1,2,56,48的信息段,需要搜索包含48字段的时候
select * from posters where FIND_IN_SET('48', poster_category_id);