这是我的查询,我要插入这应该从另一个表中选择的值:插入并选择组合不工作
insert into payment_details_kohin(installment_no)
values(
select count(installment_amount)+2
from kohin_plan.payment_details_insert
where customer_id='KBP100058'
)
...但它给我一个错误:
Msg 515, Level 16, State 2, Line 1 Cannot insert the value NULL into column 'customer_id', table 'kohinoor_rdfd.kohin_plan.payment_details_kohin'; column does not allow nulls. INSERT fails. The statement has been terminated.
当我尝试以下查询:
insert into payment_details_kohin(installment_no)
values(
select count(installment_amount)+2
from kohin_plan.payment_details_insert
where customer_id='KBP100058'
)
...它给了我下面的错误
Msg 156, Level 15, State 1, Line 2
Incorrect syntax near the keyword 'select'.
Msg 102, Level 15, State 1, Line 3
Incorrect syntax near ')'.
亲爱的朋友检查我的文章会为工作你 – Developerzzz
只需删除'值' – Hoh