Skip to content


mysql sql语句点滴

id字段补全
member表已有数据,uid从1开始自增
需要改为从100000开始。


update `member` set uid=CONCAT(1,lpad(uid,5,0));

从一个表向另一个同样结构的表插入批量的数据


insert into table1 (select * from table2)

可以用另一表的数据更新当前表

UPDATE items as a,month as b SET a.price=b.price WHERE a.id=b.id;

时间截记以当前时间显示


SELECT FROM_UNIXTIME( UNIX_TIMESTAMP( ) , ‘%Y-%m-%d %H:%i:%s’ )

当前时间以时间截记显示


SELECT UNIX_TIMESTAMP(‘1997-10-04 22:23:00’);

以xml格式输出

shell>mysql –xml
mysql> select * from tags;



1
标签1
0


1 row in set (0.03 sec)

将以’http://kx’开头内容改成’http://k’开头

update `uchome_mtag` set pic=REPLACE(pic, ‘http://kx’, ‘http://k’) WHERE left(pic,9)=’http://kx’

Posted in Mysql, 技术.

Tagged with , .


No Responses (yet)

Stay in touch with the conversation, subscribe to the RSS feed for comments on this post.



Some HTML is OK

or, reply to this post via trackback.