1. convert int to varchar often using concat function, such as concat (8, ' 0 ') to get string ' 80 '
and menu_name like CONCAT (CONCAT ('% ', #{pd.keywords}), '% ')
2. Convert varchar to int with cast (a as signed) a as varchar type string
Summary: Type conversions are like SQL Server, where type parameters are slightly different: CAST (xxx as type), convert (XXX, type)
Types of available
Binary , with binary prefix effect: binary
character type, with parameters: CHAR ()
Date: date
Time:
DateTime Date/Time type
floating point number: DECIMAL
integer: Signed
unsigned integer: UNSIGNED
SELECT * from Sys_menu where parent_id= ' 0 ' ORDER by cast (Menu_no as signed)
When Menu_no is a letter or kanji, the number converted is 0.
This article is from the "Jianbo" blog, make sure to keep this source http://jianboli.blog.51cto.com/12075002/1958445
Mysql Numeric type conversion function