Geeks With Blogs
Nouman Zakir while (true) { Post.NewArticle(); }
You can use SELECT statement to update records through UPDATE statement.
In the SET Clause use the SELECT statement along with desired filters to
update the records.


UPDATE tblDestination
SET tblDestination.col=value
WHERE EXISTS (
SELECT col2.value
FROM tblSource
WHERE tblSource.join_col=tblDestination.join_col
AND tblSource.constraint=value)
Posted on Tuesday, August 4, 2009 6:28 AM SQL | Back to top


Comments on this post: Using SELECT statement to UPDATE records in SQL

# re: Using SELECT statement to UPDATE records in SQL
Requesting Gravatar...
How would I insert it if the select part is a combination of fields from different tables?
Left by Rico on Nov 13, 2012 10:14 AM

# re: Using SELECT statement to UPDATE records in SQL
Requesting Gravatar...
How would I insert it if the select statement is a combination of fields from different tables expressed as one value?
E.g. (select A.val1 * B.Val2 as MyTotal From A,B where blah blah blah)
Left by Rico on Nov 13, 2012 10:31 AM

# re: Using SELECT statement to UPDATE records in SQL
Requesting Gravatar...
I think you have done a great job by helping us to update records in SQL using select statement. I have tried many times to do this process, but I couldn’t do it. Now I am so happy for getting a better way to complete this process. magnetic balls cube
Left by Sam on Sep 11, 2015 9:20 AM

Your comment:
 (will show your gravatar)


Copyright © Nouman Zakir | Powered by: GeeksWithBlogs.net | Join free