Goran Bibic

Goran Bibic

  • 720
  • 2.4k
  • 87.6k

Insert into from one to another table with different value

Apr 7 2020 2:14 PM
I try to explane 
 
I have this
  1.  INSERT INTO dbo.nalog_knjizenje_stavke (redni_broj, konto, naziv_konta, duguje, potrazuje, id_fakture)  
  2. select  ROW_NUMBER() OVER (ORDER BY redni_broj), konto, naziv_konta, '0.00','0.00', (select MAX(id) from dbo.nalog_knjizenje_lista) as id_fakture  
  3. from dbo.kontni_plan   
  4. where broj_dokumenta = 2301 
Result is next
 
 
That is ok. 
 
Now question, ho to put inside differtent value in last two column when are   different column konto.
 
Every my result not ok
  
Need help and need result to be example
 
 
Thank you

Answers (1)