mysql-convert関数
941 ワード
参考ブログ:https://www.cnblogs.com/chenqionghe/p/4675844.html
CAST(x AS type)
CONVERT(x,type)
この2つの関数はBINARY,CHAR,DATE,DATETIME,TIME,SIGNED INTEGER,UNSIGNED INTEGERのみである.
例:
転載先:https://www.cnblogs.com/JAYWX/articles/10147860.html
CAST(x AS type)
CONVERT(x,type)
この2つの関数はBINARY,CHAR,DATE,DATETIME,TIME,SIGNED INTEGER,UNSIGNED INTEGERのみである.
SELECT CAST('123' AS UNSIGNED INTEGER) + 1
->124
SELECT '123' + 1
->124 MySQL
SELECT CAST(NOW() AS DATE)
->2014-12-18
例:
user magicstr 16 10 sha1
update sigma_account_us_user set `password`= SHA1(CONVERT( magicstr, SIGNED )) where id=467450
転載先:https://www.cnblogs.com/JAYWX/articles/10147860.html