khawla belgacem
khawla belgacem

Reputation: 77

insert records into table where one filed is from another table

i want to insert records into table "Cours_Change" but one filed is from other table "Devise"; I have selected the liste of Devises and its id will also be inserted into table "Cours_Change"

insert into Cours_Change (DAT_JOUR_CCHN,mont_caba_cchn,mont_cabc_cchn,mont_cvba_cchn,mont_cvbc_cchn,cod_etat_cchn,cod_dev_dev, matricule_emp) 
values ('01/05/2016',2.1,2.1,2.1,2.1,'V', select d.cod_dev_dev from table Devise d where d.lib_sigl_dev='AUS', 'emp_2' );

This picture may be let you understand what i want to do

enter image description here

can you help me please

Upvotes: 1

Views: 32

Answers (1)

Rahul Tripathi
Rahul Tripathi

Reputation: 172528

Try this:

insert into Cours_Change (DAT_JOUR_CCHN,mont_caba_cchn,mont_cabc_cchn,mont_cvba_cchn,mont_cvbc_cchn,cod_etat_cchn,cod_dev_dev, matricule_emp) 
select '01/05/2016',2.1,2.1,2.1,2.1,'V', d.cod_dev_dev, 'emp_2' 
from Devise d where d.lib_sigl_dev='AUS'

Upvotes: 1

Related Questions