Quantcast
Channel: Transact-SQL forum
Viewing all articles
Browse latest Browse all 23857

add a data to table from another table with sum function

$
0
0

hello everyone.

İ have 2 tables calisanlar and Siparis_onaylanan.In calisanlar table there are calisan_no,adet and etc. columns.In Siparis_onaylanan table there are Siparis_id,urun,adet,calisan_no and etc. columns.I want to add data adet in calisanlar from sum(adet) Siparis_onaylanan.

For example

Caner Ünver's calisan_no(worker_id) 147 and add a delivery 5 banana and 4 watermelon.I want to add this numbers of items to calisanlar's adet

i wanna codes like that

update calisanlar set adet=select sum(adet) from Siparis_onaylanan where Siparis_onaylanan.calisan_no=calisanlar.calisan_no

but it doesn't work :)


Viewing all articles
Browse latest Browse all 23857

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>