首页 新闻 会员 周边 捐助

sql查询出来a表的某个字段插入到b表中,同时向a表插入别的数据

0
[已解决问题] 解决于 2012-06-28 09:02

sql查询出来a表的某个字段插入到b表中,同时向a表插入别的数据

 

RefundInfo_Config

字段

类型

为空

ID

Int

AccountId

Bigint

MaxAmount

Int

MinAmount

Int

RefundCount

Int

Rate

Int

WeekDay

Int

 

 

 

 select distinct accountId from B_AccBankPOS_Share where createtime>=2012-6-1这个是查a表的

想把查询出来的数据加上1,10000,500,1,80,5插入到b表中

insert into RefundInfo_Config (AccountId,MaxAmount,MinAmount,RefundCount,Rate,[WeekDay]) select distinct accountId from B_AccBankPOS_Share where createtime>=2012-6-1,10000,500,1,80,5

 

这样写不对。求指点

猪头猪脑的主页 猪头猪脑 | 初学一级 | 园豆:6
提问于:2012-06-27 17:40
< >
分享
最佳答案
0

把SQL语句改为:

insert into RefundInfo_Config (AccountId,MaxAmount,MinAmount,RefundCount,Rate,[WeekDay]) 
select distinct accountId,10000,500,1,80,5 
from B_AccBankPOS_Share 
where createtime>='2012-6-1'
奖励园豆:5
dudu | 高人七级 |园豆:29333 | 2012-06-27 17:52
其他回答(1)
0
1 insert into RefundInfo_Config (AccountId,MaxAmount,MinAmount,RefundCount,Rate,[WeekDay])
values (select distinct accountId from B_AccBankPOS_Share where createtime>=2012-6-1),
10000,500,1,80,5
Xheart | 园豆:178 (初学一级) | 2012-06-27 20:36
View Code
 insert into RefundInfo_Config (AccountId,MaxAmount,MinAmount,RefundCount,Rate,[WeekDay]) values((select distinct accountId from B_AccBankPOS_Share where createtime>=2012-6-1), 10000,500,1,80,5)
支持(0) 反对(0) Xheart | 园豆:178 (初学一级) | 2012-06-27 20:37
insert into RefundInfo_Config (AccountId,MaxAmount,MinAmount,RefundCount,Rate,[WeekDay]) 
select distinct accountId,10000,500,1,80,5 from B_AccBankPOS_Share where createtime>=2012-6-1

这下应该行了

支持(0) 反对(0) Xheart | 园豆:178 (初学一级) | 2012-06-27 22:39
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册