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 |
Crz_Gordo
Starting Member
1 Post |
Posted - 2013-11-08 : 03:23:22
|
Hi to all,Im designing a Accounting software a Trial Balance.The logic is like this.TRIAL BALANCE SHEETAccount Code Amount1000010000-1010010000-1020010000-10200-10201SQL TABLEACOUNTCODE TRAILS AMOUNT10000 0000010100 10000-1010010200 10000-1020010201 10000-10200-10201What i want is if i update the table using the SET AMOUNT = 100 WHERE ACCOUNTCODE = '10201' it will update the AMOUNT field of ACCOUNTCODE 10000 , 10200 , 10201OUTPUTACOUNTCODE TRAILS AMOUNT10000 00000 100.0010100 10000-1010010200 10000-10200 100.0010201 10000-10200-10201 100.00i tried CONTAINS function but it didnt work.what function i will use? |
|
visakh16
Very Important crosS Applying yaK Herder
52326 Posts |
Posted - 2013-11-08 : 04:30:27
|
[code]UPDATE t1SET AMOUNT = 100.00FROM Table t1INNER JOIN Table t2ON '-' + t2.TRAILS + '-' LIKE '%-' + t1.TRAILS + '-%'WHERE t2.ACOUNTCODE = 10201[/code]------------------------------------------------------------------------------------------------------SQL Server MVPhttp://visakhm.blogspot.com/https://www.facebook.com/VmBlogs |
|
|
|
|
|