x

Help needed to update after computing field from another

Hello, I'm Haren. I want to update Opening_Stock from table ( Product_Master ) with sum of Quantity from Issue_detail table where Product_code from both tables are equal & Issue_date is less than some specified date
more ▼

asked Jan 21, 2012 at 02:45 AM in Default

Haren gravatar image

Haren
51 10 10 11

(comments are locked)
10|1200 characters needed characters left

2 answers: sort voted first
You need to use the UPDATE... SET ... FROM ... WHERE... method to define the query. The beginning is like any UPDATE statement but from there you deviate into the FROM clause. It only gets strange because you don't have to qualify columns from the original table.
more ▼

answered Jan 21, 2012 at 03:28 AM

Grant Fritchey gravatar image

Grant Fritchey ♦♦
98.1k 19 21 74

Thanks Fritchey I'll try & see
Jan 21, 2012 at 03:38 AM Haren
(comments are locked)
10|1200 characters needed characters left
Your answer
toggle preview:

Up to 2 attachments (including images) can be used with a maximum of 524.3 kB each and 1.0 MB total.

New code box

There's a new way to format code on the site - the red speech bubble logo will automatically format T-SQL for you. The original code box is still there for XML, etc. More details here.

Follow this question

By Email:

Once you sign in you will be able to subscribe for any updates here

By RSS:

Answers

Answers and Comments

SQL Server Central

Need long-form SQL discussion? SQLserverCentral.com is the place.

Topics:

x237
x74

asked: Jan 21, 2012 at 02:45 AM

Seen: 837 times

Last Updated: Jan 22, 2012 at 02:03 AM