Results 1 to 3 of 3
  1. #1
    Join Date
    Oct 2012

    Unanswered: New to SQL - Update Query Help

    As the title said - new to SQL - I am trying to get some very old SQL data cleaned up on a live database for our investment wine storage company so it can be moved and imported in a new system.

    Let me start by saying the SQL database is using a .net exe client application that was built in 2003-2004. That said, there are some flaws in the program that cause duplicate information to be inserted in the database.

    Example of Data problem: We record in a table the Region where the wine was produced - that table only has 2 fields: REGIONID and REGIONNAME.

    The program has over 10,000 records, and each Region has hundreds of duplicates. Additionally, the REGIONID is referenced in only one other table: BOTTLE table.

    The goal is to reduce the REGION table to one entry for each region and to update the BOTTLE Table using an UPDATE to change all of the duplicates of one specific region. (We have 930 entries for "Burgundy", I was going to pick one of the REGIONIDs that correspond to "Burgundy" and Update the BOTTLE table to that one REGIONID)

    I started to create a simple UPDATE query but it seems that i can change only one REGIONID at a time in the BOTTLE table. What I would Like to do is add multiple selections in the WHERE language so that I can do this faster than one REGIONID at a time.

    UPDATE [WineDB].[dbo].[Bottle]
    SET [REGIONID] = 1
    WHERE [REGIONID] = 149 (Is there syntax to allow more than one parameter)

    If this is the wrong direction and I should be tackling this in a different way, please let me know - I am very much a lightweight in this arena. Any help would be appreciative or a direction or post where I can work out the problem myself.


    Jamie B.

  2. #2
    Join Date
    Sep 2006
    Surrey, UK
    Provided Answers: 2
    where [regionid] in (149,150,151,...)
    10% of magic is knowing something that no-one else does. The rest is misdirection.

  3. #3
    Join Date
    Oct 2012
    Awesome -

    I will try it this morning.

    Much appreciated

    Jamie B.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts