您的位置:首页 > 数据库 > MySQL

mysql常用语句

2015-10-20 17:19 507 查看
1、用户A表的某一列更新B表的某一列

eg:用t2表的c_account_id替换t1表的c_counter_part_id字段

update t_invest_account_cashflow t1 set
t1.c_counter_part_id=(select t2.c_account_id from
t_invest_account t2 where
t1.c_invest_account_id=t2.c_invest_account_id )


2、产生自增编号

rowNum将从1开始自增

set @row=0;
select c_account_cashflow_id ,@row:=@row+1 rowNum
from t_account_cashflow where
c_account_cashflow_id ;
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: