Please start any new threads on our new site at 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
Save Password
Forgot your Password?

 All Forums
 SQL Server 2012 Forums
 Transact-SQL (2012)
 select in update
 Reply to Topic
 Printer Friendly
Author Previous Topic Topic Next Topic  

Starting Member

1 Posts

Posted - 09/29/2013 :  14:21:12  Show Profile  Reply with Quote
hi every one, i hope god time

I have two tables,

1st Table is the Table1, Table which has no,l2p.

2nd Table is Table2, Table which has no, DUM

i want update Table1 table
but that update need DUM in Table2 table
so i write select on Table2 in update on Table1
example flow code:

UPDATE Table1 
l2p= 0.207 * (SELECT DUM FROM Table2 WHERE [no] < 1389)
 WHERE [no] < 1389 

this code is not error but this did not work
that select only is working and this update too
but whit both of them update and select do not work

Edited by - darya on 09/29/2013 16:25:12

James K
Flowing Fount of Yak Knowledge

3873 Posts

Posted - 09/29/2013 :  16:59:03  Show Profile  Reply with Quote
update like this:
update t1 set
	l2p = 0.207*t2.dum
	Table1 as t1
	inner join Table2 as t2
		on =
	t1.[no] < 1389;

Edited by - James K on 09/29/2013 16:59:59
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.04 seconds. Powered By: Snitz Forums 2000