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
这样写不对。求指点
把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'
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
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)
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
这下应该行了