求存储过程 在mysql存储过程中如何把得到的系统时间转化成整行。例如:2011-09-10 18:27:36 转化为 20110910182736 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 mysql> Select date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s');+---------------------------------------------------+| date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s') |+---------------------------------------------------+| 20110910182736 |+---------------------------------------------------+1 row in set (0.22 sec)mysql> mysql>Select date_format(now(),'%Y%m%d%H%i%s');+-----------------------------------+| date_format(now(),'%Y%m%d%H%i%s') |+-----------------------------------+| 20110910193926 |+-----------------------------------+1 row in set (0.00 sec) mysql>Select date_format(now(),'%Y%m%d%H%i%s');+-----------------------------------+| date_format(now(),'%Y%m%d%H%i%s') |+-----------------------------------+| 20110910193926 |+-----------------------------------+写个存储过程 调用下 看看返回的是int 型吗? 你什么时候说要INT型了?!mysql> Select date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s')+0;+-----------------------------------------------------+| date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s')+0 |+-----------------------------------------------------+| 20110910182736 |+-----------------------------------------------------+1 row in set (0.39 sec)mysql>问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧) 他说了“整行”,看到到四楼,我才知道,是整xing,不是整hang,唉,我的语文没过关…… 如果不追求INT型的话,只是数字型,则可以直接加。mysql> select now(),now()+0;+---------------------+-----------------------+| now() | now()+0 |+---------------------+-----------------------+| 2011-09-10 22:07:15 | 20110910220715.000000 |+---------------------+-----------------------+1 row in set (0.00 sec) sql语句这样写可不可以 mysql cluster疑惑 sql 两字段相乘 后累加 能实现不? 在mysql中用什么语句查询所有的数据库名字 帮忙写个多表之间查询的语句(mysql),在线等 如何优化日期查询的SQL语句 如何对一个BLOB字段进行查询? txt文件导入到mysql mysql占用资源,怎么查有问题的mysql用户 MySQL主从同步出现 Slave_IO_Running: No(一台计算机,两个mysql服务都在本地),求大佬指点!小弟给您跪了! MySql查询显示的问题 group by 问题
+---------------------------------------------------+
| date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s') |
+---------------------------------------------------+
| 20110910182736 |
+---------------------------------------------------+
1 row in set (0.22 sec)mysql>
+-----------------------------------+
| date_format(now(),'%Y%m%d%H%i%s') |
+-----------------------------------+
| 20110910193926 |
+-----------------------------------+
1 row in set (0.00 sec)
+-----------------------------------+
| date_format(now(),'%Y%m%d%H%i%s') |
+-----------------------------------+
| 20110910193926 |
+-----------------------------------+
写个存储过程 调用下 看看返回的是int 型吗?
+-----------------------------------------------------+
| date_format('2011-09-10 18:27:36','%Y%m%d%H%i%s')+0 |
+-----------------------------------------------------+
| 20110910182736 |
+-----------------------------------------------------+
1 row in set (0.39 sec)mysql>
问题说明越详细,回答也会越准确!参见如何提问。(提问的智慧)
mysql> select now(),now()+0;
+---------------------+-----------------------+
| now() | now()+0 |
+---------------------+-----------------------+
| 2011-09-10 22:07:15 | 20110910220715.000000 |
+---------------------+-----------------------+
1 row in set (0.00 sec)