mssql change value in table

Posted on 2009-04-18
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


Table A)




Table B)




Open in new window

Question by:Benji_
    LVL 15

    Accepted Solution

    update table A
    set statusflag = 2
    where Exists (select 1 from table b where serial = table A.serial)

    That would be one way
    LVL 2

    Author Closing Comment

    Thank you! i knew there was a simple answer:D

    Best Regards

    Featured Post

    Enabling OSINT in Activity Based Intelligence

    Activity based intelligence (ABI) requires access to all available sources of data. Recorded Future allows analysts to observe structured data on the open, deep, and dark web.

    Join & Write a Comment

    This article explains all about SQL Server Piecemeal Restore with examples in step by step manner.
    Slowly Changing Dimension Transformation component in data task flow is very useful for us to manage and control how data changes in SSIS.
    Via a live example combined with referencing Books Online, show some of the information that can be extracted from the Catalog Views in SQL Server.
    Using examples as well as descriptions, and references to Books Online, show the different Recovery Models available in SQL Server and explain, as well as show how full, differential and transaction log backups are performed

    728 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

    Need Help in Real-Time?

    Connect with top rated Experts

    20 Experts available now in Live!

    Get 1:1 Help Now