mysql记录

批量删除数据库表

Select CONCAT( 'drop table ', table_name, ';' ) 
FROM information_schema.tables 
where  table_schema='数据库名称' 
/*条件*/
and table_name not in(select Code as table_name from FW_Table)

  修改字段值来自另一张表:

update tpb_goods as z left join tpb_allocation_order_goods as zb on z.goods_id = zb.goods_id set z.qty =z.qty- zb.qty where z.goods_id in(SELECT goods_id from tpb_allocation_order_goods); 

 查询表的所有字段结果用逗号隔开

select GROUP_CONCAT(COLUMN_NAME SEPARATOR ",") from INFORMATION_SCHEMA.Columns where table_name='表名'

posted @ 2017-07-07 10:56  wuyubing  阅读(147)  评论(0编辑  收藏  举报