Please start any new threads on our new
site at https://forums.sqlteam.com. We've got lots of great SQL Server
experts to answer whatever question you can come up with.
| Author |
Topic |
|
riagil
Starting Member
4 Posts |
Posted - 2010-08-15 : 06:31:56
|
| Dear All, the best programmer...I have 2 table : peminjaman and tmpindukpeminjaman :mulai | kembali | nis | induk | jml_buku | denda | status13/8/2010 | 15/8/2010 | 21 | 144 | 2 | 100 | 013/8/2010 | 15/8/2010 | 21 | 145 | 3 | 100 | 014/8/2010 | 16/8/2010 | 22 | 146 | 2 | 100 | 013/8/2010 | 15/8/2010 | 23 | 147 | 2 | 100 | 0tmpinduk :induk | jdl_buku | pengarang | penerbit | jml_buku | status144 | Naruto | Masashi | Elex | 1 | 1145 | Bleach | Kung Chou | Gramedia | 1 | 1146 | One Piece| Enola | Elexindo | 2 | 1147 | Omega | Makabir | Estream | 1 | 1my questions :- How do I update tmpinduk from peminjaman, when I update, I hope my result as :induk | jdl_buku | pengarang | penerbit | jml_buku | status144 | Naruto | Masashi | Elex | 3 | 1145 | Bleach | Kung Chou | Gramedia | 4 | 1146 | One Piece| Enola | Elexindo | 4 | 1147 | Omega | Makabir | Estream | 3 | 1the simple is "jml_buku on peminjaman + jml_buku on tmpinduk ", then result is above...help me please.....I'm sorry with my english. |
|
|
webfred
Master Smack Fu Yak Hacker
8781 Posts |
Posted - 2010-08-15 : 06:53:19
|
update tset t.jml_buku = t.jml_buku + p.jml_buku from tmpinduk as tjoin peminjaman as pon p.induk = t.induk No, you're never too old to Yak'n'Roll if you're too young to die. |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-15 : 10:49:46
|
| can there be multiple records in peminjaman per jml_buku value?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
riagil
Starting Member
4 Posts |
Posted - 2010-08-15 : 22:06:18
|
quote: Originally posted by webfred update tset t.jml_buku = t.jml_buku + p.jml_buku from tmpinduk as tjoin peminjaman as pon p.induk = t.induk No, you're never too old to Yak'n'Roll if you're too young to die.
Hi webfred.. Thanks for your help, but i get this error..."string or binary data would be truncated.""the statement has been terminated." |
 |
|
|
riagil
Starting Member
4 Posts |
Posted - 2010-08-15 : 22:07:12
|
quote: Originally posted by visakh16 can there be multiple records in peminjaman per jml_buku value?------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/
Yes there visakh16.... |
 |
|
|
riagil
Starting Member
4 Posts |
Posted - 2010-08-15 : 22:33:03
|
| This is my complete table structure and content :tmpinduk :----------------------------------------------------------------induk | jdl_buku | pengarang | penerbit |jml_buku |status |----------------------------------------------------------------144 | Cerita Rakyat | Iskandar | Bondan | 2 | 0 | 155 | Naruto Komik | Masashi Kishimoto | Elexmedia | 0 | 0 | 156 | Bleach Komik | Masashi Kishimoto | Elexmedia | 1 | 0 | 177 | Teori Pembangunan | Mulyanto | UI-PRESS | 0 | 0 | 179 | Ensiklopedia Hewan | - | Gramedia | 2 | 0 | 180 | Ensiklopedia Tumbuhan | - | Gramedia | 1 | 0 | 181 | Teknologi | Roy Suryo, MT | Ganeca | 2 | 0 | 182 | Baskeball Fundamental | Phil Jackson | Elexmedia | 1 | 0 | peminjaman :-----------------------------------------------------------------| mulai | kembali | nis |induk | jml_buku | denda | status |-----------------------------------------------------------------16/8/2010 | 18/8/2010 | 6325 | 155 | 3 | 0 | 0 |16/8/2010 | 18/8/2010 | 6325 | 156 | 2 | 0 | 0 |16/8/2010 | 18/8/2010 | 6464 | 144 | 1 | 0 | 0 |16/8/2010 | 18/8/2010 | 6464 | 177 | 1 | 0 | 0 |the table above is a sample to imagine what I want...Thanks a lot... |
 |
|
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2010-08-16 : 05:16:37
|
| sorry i meant per induk value. your sample shows only 1 record per induk value so no issues------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/ |
 |
|
|
|
|
|