August 5, 2008 at 5:29 am
Hi i want to use select statement in update Clause means in a single update statement all the rows has been updated on a particular condition please provide me help thanks in advance!!
August 5, 2008 at 6:29 am
I am not sure if I understand your question, but you might want to give a look at the OUTPUT clause for the UPDATE statement in books online.
August 5, 2008 at 6:38 am
Maybe you mean something like this?
this updates a table, and uses a SELECT to pull in relevant data from a select statement?
[font="Courier New"]
UPDATE SomeTable
SET SomeTable.BudgetAmount = X.BudgetAmount
FROM
(
SELECT ID,SUM(AMT) AS BudgetAmt FROM OtherTable WHERE SomeField = 1 GROUP BY ID
) X --aliased this select statement as X
WHERE SomeTable.Id = X.ID
[/font]
Lowell
Viewing 3 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy