Please start any new threads on our new site at http://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

Our new SQL Server Forums are live! Come on over! We've restricted the ability to create new threads on these forums.

SQL Server Forums
Profile | Active Topics | Members | Search | Forum FAQ
 
Register Now and get your question answered!
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 how to update data from 3 tables
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

dwi555
Starting Member

Indonesia
9 Posts

Posted - 06/12/2013 :  23:18:41  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2241 Posts

Posted - 06/13/2013 :  00:04:46  Show Profile  Reply with Quote
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

Indonesia
9 Posts

Posted - 06/13/2013 :  00:24:09  Show Profile  Reply with Quote
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
Flowing Fount of Yak Knowledge

India
2241 Posts

Posted - 06/13/2013 :  00:28:41  Show Profile  Reply with Quote
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
  Previous Topic Topic Next Topic  
 Reply to Topic
 Printer Friendly
Jump To:
SQL Server Forums © 2000-2009 SQLTeam Publishing, LLC Go To Top Of Page
This page was generated in 0.05 seconds. Powered By: Snitz Forums 2000