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.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to update data from 3 tables

Author  Topic 

dwi555
Starting Member

9 Posts

Posted - 2013-06-12 : 23:18:41
hello, can anyone help me. i have this code

select a.unitkey, a.nospp, b.nobpk, c.nospj
from (table1 a inner join table2 b on a.unitkey=b.unitkey) inner join table3 c on b.unitkey=c.unitkey
where a.unitkey='42_' and a.nospp='900/13/2013' and b.nobpk like '%001/feb%' and c.nospj like '%jan%'

and this is the results

-----------------------------------------------------
unitkey | nospp | nobpk | nospj |
-----------------------------------------------------
42_ | 900/13/2013 | 00001/feb | 0001/jan |
-----------------------------------------------------

i want to update nospj. anyone can help me what is the code to update that. thanks.. (sorry for bad english)

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-13 : 00:04:46
UPDATE c
SET c.nospj = YourValue/column/expression
from (table1 a inner join table2 b on a.unitkey=b.unitkey) inner join table3 c on b.unitkey=c.unitkey
where a.unitkey='42_' and a.nospp='900/13/2013' and b.nobpk like '%001/feb%' and c.nospj like '%jan%'


--
Chandu
Go to Top of Page

dwi555
Starting Member

9 Posts

Posted - 2013-06-13 : 00:24:09
quote:
Originally posted by bandi

UPDATE c
SET c.nospj = YourValue/column/expression
from (table1 a inner join table2 b on a.unitkey=b.unitkey) inner join table3 c on b.unitkey=c.unitkey
where a.unitkey='42_' and a.nospp='900/13/2013' and b.nobpk like '%001/feb%' and c.nospj like '%jan%'


--
Chandu



great,., thanks chandu
Go to Top of Page

bandi
Master Smack Fu Yak Hacker

2242 Posts

Posted - 2013-06-13 : 00:28:41
quote:
Originally posted by dwi555

quote:
Originally posted by bandi

UPDATE c
SET c.nospj = YourValue/column/expression
from (table1 a inner join table2 b on a.unitkey=b.unitkey) inner join table3 c on b.unitkey=c.unitkey
where a.unitkey='42_' and a.nospp='900/13/2013' and b.nobpk like '%001/feb%' and c.nospj like '%jan%'


--
Chandu



great,., thanks chandu


Welcome

--
Chandu
Go to Top of Page
   

- Advertisement -