A piece of Thinking Caused by a Mysql statement today I saw a mysql statement written by my colleagues, but I suddenly felt the gap. In my mind, mysql statements are only added, deleted, queried, and modified. They can still be written in this way. [Php] $ SQL = "SELECT category_general_table FROM product_category WHERE category_id IN (SELECT DISTINCT CAST (SUBSTRING (product_code, 1, 5) AS UNSIGNED) AS cid FROM product_index WHERE member_id = $ memberId AND shop_id = $ shopId) "; I have never written this like CAST or SUBSTRI NG. After checking the manual, another function CONVERT is similar to it. Cast (value as type); Convert (value, type); type can not be dropped. The type that can be converted is binary, which has the same effect as BINARY prefix, possible parameter: CHAR () DATE: date time: time date type: DATETIME floating point number: decimal integer: signed unsigned integer: UNSIGNED it seems that I still have to read more manual.