?
Solved

mssql change value in table

Posted on 2009-04-18
2
Medium Priority
?
1,027 Views
Last Modified: 2012-05-06
Hey Guys,

I have a database and when a customer places an order it creates there record in the system,

When our order team pickup we attach the serial number of the product before we dispatch the order,
When our supplier pays our commision for sale i import that into table  b.

I need to update a colum in the otherstable to change the status of the order how would i do this.


Table B needs to have a count of 1 or more and then i want table a) stausflag to change to 2

Regards

Table A)
 
ID
Serial
StatusCode 
 
Table B)
ID
Serial
Amount

Open in new window

0
Comment
Question by:Benji_
2 Comments
 
LVL 16

Accepted Solution

by:
Walter Ritzel earned 2000 total points
ID: 24176172
update table A
set statusflag = 2
where Exists (select 1 from table b where serial = table A.serial)

That would be one way
0
 
LVL 2

Author Closing Comment

by:Benji_
ID: 31571809
Thank you! i knew there was a simple answer:D

Best Regards
0

Featured Post

Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

What we learned in Webroot's webinar on multi-vector protection.
How much do you know about the future of data centers? If you're like 50% of organizations, then it's probably not enough. Read on to get up to speed on this emerging field.
Viewers will learn how to use the INSERT statement to insert data into their tables. It will also introduce the NULL statement, to show them what happens when no value is giving for any given column.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.
Suggested Courses

571 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question