Update with Sub Query

  • Hi,

    I am trying to copy minimum stock levels in a sotck table, ie. set all min stock levels for

    branch 3 the same as branch 1.

    I tried this... but the select returns multiple values so doesn't work.

    Can anyone help please?

    UPDATE [Stock Detail]

    SET [Minimum Stock Level] = (SELECT [Minimum Stock Level]

    FROM [Stock Detail] WHERE [Branch ID] = '1')

    WHERE [Branch ID] = '3'

  • It would be best if you would post the details of each of the tables, and what foreign keys exist in them in order for some one to give you a detailed answer. Read the link in my signature block and post the requested / suggested input. For example do both the branches contain the same item idenfification or do all items in a given branch have the same minimum stock level (highly unlikely)

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

  • Hi, thanks for the quick reply.

    For the table details you want the complete create table queries ? they are quite large. 🙂

    Neil.

  • For example do both the branches contain the same item identification

    It would be productive, that is getting you some assistance, to include any foreign keys, pertinent constraints but not the entire table definition. And of course some sample data, but not such that it would reveal sensitive information and place your company at what could be a competitive disadvantage.

    If everything seems to be going well, you have obviously overlooked something.

    Ron

    Please help us, help you -before posting a question please read[/url]
    Before posting a performance problem please read[/url]

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic. Login to reply