dbTalk Databases Forums  

Get value from query to update another another table

comp.databases.ms-sqlserver comp.databases.ms-sqlserver


Discuss Get value from query to update another another table in the comp.databases.ms-sqlserver forum.



Reply
 
Thread Tools Display Modes
  #1  
Old   
rzito@si.rr.com
 
Posts: n/a

Default Get value from query to update another another table - 10-26-2007 , 03:04 PM






I have a query that simply slelcts the min value of a specified field
from one table, I want to take that value to update a field in
annother table, just can not figure it out.


Reply With Quote
  #2  
Old   
Erland Sommarskog
 
Posts: n/a

Default Re: Get value from query to update another another table - 10-26-2007 , 04:35 PM






(rzito (AT) si (DOT) rr.com) writes:
Quote:
I have a query that simply slelcts the min value of a specified field
from one table, I want to take that value to update a field in
annother table, just can not figure it out.
UPDATE tbl
SET col = (SELECT MIN(somecol) FROM othertbl)
WHERE ...



--
Erland Sommarskog, SQL Server MVP, esquel (AT) sommarskog (DOT) se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pro...ads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinf...ons/books.mspx


Reply With Quote
Reply




Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off



Powered by vBulletin Version 3.5.3
Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.