You are here: Re: Get value from query to update another another table « MsSQL Server « IT news, forums, messages
Re: Get value from query to update another another table

Posted by Erland Sommarskog on 10/26/07 21:35

(rzito@si.rr.com) writes:
> 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@sommarskog.se

Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/prodtechnol/sql/2005/downloads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodinfo/previousversions/books.mspx

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация